home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1997 February / PC Shareware 1997-02.iso / programy / envlp122 / envelop.3 / Program / envelop.eto < prev    next >
Encoding:
Text File  |  1996-03-15  |  327.0 KB  |  10,850 lines

  1. Begin Code
  2.   ModuleManager.PublishObjectDLL("evdev.dll")
  3. End Code
  4.  
  5. Type SampleMasterFormHelpMenu From PopupMenu
  6. End Type
  7.  
  8. Type Envelop From Application
  9.   Type Help From HelpFile
  10.  
  11.     ' METHODS for object: Envelop.Help
  12.     Sub ShowMethodHelp(method As String, obj As Object)
  13.       If Not ShowTopicHelp(method & "_Method_" & FieldDefiner(obj, method)) Then 
  14.         ' Try to look for help for an Event by this name
  15.         dim eventName as string
  16.         dim i as integer
  17.         Dim s as String
  18.         dim o as Object
  19.         eventName = method
  20.         ' If there is an "_" if name (e.g. Button1_Click), take last part as event name
  21.         i = Instr(method, "_")
  22.         If i Then 
  23.           ' Since we are looking for an event with the "host-defined" syntax (i.e. Button1_Click)
  24.           ' we need to find the name of the object referred to by the first component of the name
  25.           ' (i.e. "Button1")
  26.           eventName = Mid(method, i + 1)
  27.           obj = FindEmbed(obj, Left(method, i - 1))
  28.         End If
  29.     
  30.         ' Since we don't know where Event may be defined look on each Object up parent chain.
  31.         s = obj
  32.         While (s <> "")
  33.           If ShowTopicHelp(eventName & "_Event_" & s) Then Exit Sub
  34.           o = FindObject(s)
  35.           s = RootName(o)
  36.         Wend
  37.     
  38.         InfoBox.Message("Missing Help", "No help available for Method: " & method)
  39.       End If
  40.     End Sub
  41.  
  42.     Sub ShowObjectHelp(obj As Object)
  43.       Dim s as String
  44.       dim o as Object
  45.       s = obj
  46.       While (s <> "")
  47.         If ShowTopicHelp(s & "_Object") Then Exit Sub
  48.         ' Show Help for parent object if not available for self.
  49.         o = FindObject(s)
  50.         s = RootName(o)
  51.       Wend
  52.       InfoBox.Message("Missing Help", "No help available for Object: " & obj)
  53.     End Sub
  54.  
  55.     Sub ShowPropertyHelp(prop As String, obj As Object)
  56.       ShowTopicHelp(prop & "_Property_" & FieldDefiner(obj, prop))
  57.     End Sub
  58.  
  59.     Function ShowTopicHelp(topicName As String) As Integer
  60.       dim helpIndex as long
  61.       If EnvelopHelpTable.FindValue(topicName, helpIndex) Then 
  62.         GotoContext(helpIndex)
  63.         ShowTopicHelp = True
  64.       Else 
  65.         ShowTopicHelp = False
  66.       End If
  67.     End Function
  68.  
  69.   End Type
  70.   Type EBOOpen From OpenDialog
  71.  
  72.     ' METHODS for object: Envelop.EBOOpen
  73.     Function BrowseForModule As ObjectModule
  74.       static lastFilterIndex As Integer
  75.     
  76.       FileMustExist = True
  77.       FileName = ""
  78.       DefaultExtension = ""
  79.       InitialDir = Envelop.FileDialogDir
  80.       NoChangeDir = True
  81.       If (lastFilterIndex = 0) Then lastFilterIndex = 1 ' Default initialization
  82.       FilterIndex = lastFilterIndex
  83.     
  84.       If Execute = 1 Then 
  85.         ' Make busy cursor show immediately
  86.         If App Then App.ShowBusySignal
  87.         ' Note: "FileName" may refer to a Text-based Module (.eto)
  88.         If True Then 
  89.           ' Allow trapping of exceptions from code run as a result of loading
  90.           Dim suspend As New SuspendIgnoreExceptions
  91.           BrowseForModule = ModuleManager.LoadModule(FileName, False)
  92.         End If
  93.         ' Remember what last type of file was user loaded.
  94.         lastFilterIndex = FilterIndex
  95.         Envelop.FileDialogDir = FileName
  96.       Else 
  97.         BrowseForModule = Nothing
  98.       End If
  99.     End Function
  100.  
  101.   End Type
  102.   Type ETOOpen From OpenDialog
  103.  
  104.     ' METHODS for object: Envelop.ETOOpen
  105.     Sub MergeEto()
  106.       FileMustExist = True
  107.       FileName = ""
  108.       DefaultExtension = ""
  109.       InitialDir = Envelop.FileDialogDir
  110.       NoChangeDir = True
  111.       FilterIndex = 1
  112.       If Execute = 1 Then 
  113.         ' Make busy cursor show immediately
  114.         If App Then App.ShowBusySignal
  115.         If True Then 
  116.           ' Allow trapping of exceptions from code run as a result of loading
  117.           Dim suspend As New SuspendIgnoreExceptions
  118.           ObjectTools.LoadTextObject(FileName)
  119.         End If
  120.         ObjectViewer.Reset
  121.         Envelop.FileDialogDir = FileName
  122.       End If
  123.     End Sub
  124.  
  125.   End Type
  126.   Type SADlg From SaveAsDialog
  127.  
  128.     ' METHODS for object: Envelop.SADlg
  129.     Function DisplayDialog(m as ObjectModule) As Boolean
  130.       ' Return FALSE only if user cancels
  131.       DisplayDialog = True
  132.     
  133.       InitialDir = Envelop.FileDialogDir
  134.       NoChangeDir = True
  135.     
  136.       ' Display the dialog and react
  137.       If Execute = IDOK Then 
  138.         Dim AsText As Boolean
  139.         AsText = TypeFileName(m.IsText)
  140.     
  141.         ' Make busy cursor show immediately
  142.         If App Then App.ShowBusySignal
  143.     
  144.         ' Save Module and Reset object viewer
  145.         m.SaveAs(FileName, AsText)
  146.         ObjectViewer.ResetModuleString(m)
  147.         Envelop.FileDialogDir = FileName
  148.       Else 
  149.         DisplayDialog = False
  150.       End If
  151.     
  152.     End Function
  153.  
  154.     Function SaveAs(m As ObjectModule) As Boolean
  155.       ' Return FALSE only if user cancels
  156.       Dim f as new File
  157.     
  158.       f.FileName = m.FileName
  159.       If m.IsUntitled Then 
  160.         FileName = "mod" & m.UntitledSerialNum
  161.         Title = "Save Module " & m.DisplayName & " As"
  162.       Else 
  163.         FileName = f.Name
  164.         Title = "Save Module As"
  165.       End If
  166.     
  167.       ' Setup the filter based on current save mode.
  168.       Filter = "Envelop binary (*.ebo)|*.ebo|Envelop text (*.eto)|*.eto|"
  169.       If (m.IsText) Then 
  170.         FilterIndex = 2
  171.       Else 
  172.         FilterIndex = 1
  173.       End If
  174.       DefaultExtension = ""
  175.     
  176.       ' Display the dialog and react
  177.       SaveAs = DisplayDialog(m)
  178.     
  179.     End Function
  180.  
  181.     Function SaveModule(m as ObjectModule) As Boolean
  182.       ' Return FALSE only if user cancels an untitled save
  183.       SaveModule = True
  184.     
  185.       ' Leave if there's nothing to save
  186.       If m.ReadOnly || Not m.IsModified Then Exit Function
  187.     
  188.       ' Prompt for a file, if necessary
  189.       If m.IsUntitled Then 
  190.         FileName = "mod" & m.UntitledSerialNum
  191.         Title = "Select file for module " & m.DisplayName
  192.         Filter = "Envelop binary (*.ebo)|*.ebo|Envelop text (*.eto)|*.eto|"
  193.         FilterIndex = 1
  194.         DefaultExtension = ""
  195.     
  196.         ' Display the dialog and react
  197.         SaveModule = DisplayDialog(m)
  198.     
  199.       Else 
  200.         ' Make busy cursor show immediately
  201.         If App Then App.ShowBusySignal
  202.     
  203.         m.Save
  204.       End If
  205.     
  206.     End Function
  207.  
  208.     Function TypeFileName(ByVal AsText as Boolean) As Boolean
  209.       ' Type file based on extension and filter selection
  210.       Dim f as New File
  211.       f.FileName = FileName
  212.       If (f.Extension = "") Then 
  213.         If FilterIndex = 1 Then 
  214.           AsText = False
  215.           FileName = f.FileName & ".ebo"
  216.         Else 
  217.           AsText = True
  218.           FileName = f.FileName & ".eto"
  219.         End If
  220.       Else 
  221.         ' Recognize a couple of suffixes and force save mode
  222.         If (StrComp(Right(FileName, 3), "ebo") = 0) Then AsText = False
  223.         If (StrComp(Right(FileName, 3), "eto") = 0) Then AsText = True
  224.       End If
  225.       TypeFileName = AsText
  226.     End Function
  227.  
  228.     Sub WriteObjectAsText(obj as Object)
  229.       If HostObject(obj) Then 
  230.         Dim mb As New MessageBox
  231.         mb.SetIconExclamation
  232.         mb.Message("Invalid object", "Embedded objects cannot be saved as standalone text objects.")
  233.         Exit Sub
  234.       End If
  235.     
  236.       FileName = ""
  237.       Title = "Save object: " & obj & " to text as"
  238.     
  239.       ' Setup the filter to specify .eto files
  240.       Filter = "Envelop text (*.eto)|*.eto|"
  241.       FilterIndex = 1
  242.       DefaultExtension = ""
  243.       NoChangeDir = True
  244.       InitialDir = Envelop.FileDialogDir
  245.     
  246.       If Execute = 1 Then 
  247.         ' Type file based on extension and filter selection
  248.         Dim f as New File
  249.         f.FileName = FileName
  250.         If (f.Extension = "") Then FileName = f.FileName & ".eto"
  251.         ' Make busy cursor show immediately
  252.         App.ShowBusySignal
  253.         ObjectTools.SaveTextObject(FileName, False, obj)
  254.         Envelop.FileDialogDir = FileName
  255.       End If
  256.     End Sub
  257.  
  258.   End Type
  259.   Dim FileDialogDir_ As String
  260.   Property FileDialogDir Get getFileDialogDir Set setFileDialogDir As String
  261.   Dim SamplesPath As String
  262.  
  263.   ' METHODS for object: Envelop
  264.   Function CanClose() As Integer
  265.     Dim m As ObjectModule
  266.     Dim p As Project
  267.     Dim i, n, r As Integer
  268.     Dim ync As New YesNoCancelBox
  269.     Dim CANCEL_EXIT, OK_TO_EXIT, REVERT_ON_EXIT As Integer
  270.   
  271.     CANCEL_EXIT = 0
  272.     OK_TO_EXIT = 1
  273.     REVERT_ON_EXIT = 2
  274.     ync.title = "Quit"
  275.     CanClose = OK_TO_EXIT
  276.   
  277.     ' Check to see if there are any changes at all.
  278.     If Not ObjectViewer.SaveAll_Enable Then 
  279.       CanClose = OK_TO_EXIT
  280.       Exit Function
  281.     End If
  282.   
  283.     ' Ask user if he wants to save any changes
  284.     r = ync.Msg("Do you want to save changes? (No = revert to last save)")
  285.     If r = IDCANCEL Then 
  286.       CanClose = CANCEL_EXIT
  287.       Exit Function
  288.     ElseIf r = IDNO Then 
  289.       CanClose = REVERT_ON_EXIT
  290.       Exit Function
  291.     End If
  292.   
  293.     ' Save any projects that user wants. If user cancels anything, then
  294.     ' CheckAndSaveProject returns FALSE and we abort the exit.
  295.     n = ProjectManager.ProjectCount - 1
  296.     For i = 0 To n
  297.       If Not ObjectViewer.CheckAndSaveProject(ProjectManager.Project(i)) Then 
  298.         CanClose = CANCEL_EXIT
  299.         Exit Function
  300.       End If
  301.     Next i
  302.   
  303.     ' The 0th module is always the intrinsic module, so skip it.
  304.     n = ModuleManager.ModuleCount - 1
  305.     For i = 1 To n
  306.       m = ModuleManager.Module(i)
  307.       If m.ReadOnly = False && m.IsModified Then 
  308.         r = ync.Msg("Save changes to module " & m.DisplayName & "?")
  309.         If r = IDCANCEL Then 
  310.           CanClose = CANCEL_EXIT
  311.           Exit Function
  312.         ElseIf r = IDYES Then 
  313.           If Not Envelop.SADlg.SaveModule(m) Then 
  314.             CanClose = CANCEL_EXIT
  315.             Exit Function
  316.           End If
  317.         End If
  318.       End If
  319.     Next i
  320.   End Function
  321.  
  322.   Function getFileDialogDir() As String
  323.     Dim Dir as New Directory
  324.     Dir.Path = FileDialogDir_
  325.     If Dir.Exists Then 
  326.       getFileDialogDir = FileDialogDir_
  327.     Else 
  328.       getFileDialogDir = ""
  329.     End If
  330.   End Function
  331.  
  332.   Sub setFileDialogDir(newValue As String)
  333.     ' FileDialogDir is configured to accept either a directory or a file.
  334.     ' If it gets a file, it will extract the path from it.
  335.     If Instr(newValue, ".") > 0 Then 
  336.       Dim f as New File
  337.       f.FileName = newValue
  338.       FileDialogDir_ = f.Path
  339.     Else 
  340.       FileDialogDir_ = newValue
  341.     End If
  342.     ProjectStartupOptions.FileDialogDir = FileDialogDir_
  343.     ModuleManager.ModuleContaining(ProjectStartupOptions).Save
  344.   End Sub
  345.  
  346.   Sub Shutdown
  347.     Help.Quit
  348.   End Sub
  349.  
  350.   Sub Startup
  351.     ' Secure this object to prevent deletion.
  352.     ' TODO: Need to specify can't delete or rename security, can't use general, because
  353.     ' then methods and properties can't be changed either.
  354.     ' SecureObject(Me, ACL)
  355.   
  356.     ' Initialize paths to help and samples
  357.     Help.FileName = App.Path & "..\help\envelop.hlp"
  358.     SamplesPath = "..\Examples"
  359.   
  360.     ' Define Application Main Form
  361.     MainForm = EnvelopForm
  362.   
  363.     ' Show startup dialog according to options
  364.     ProjectStartupDialog.Execute
  365.   End Sub
  366.  
  367.   Function TextUnload(ByVal indent As String, cmds As String) As Integer
  368.     ' Write our parent's properties, but none of ours.
  369.     TextUnload = False
  370.   End Function
  371.  
  372. End Type
  373.  
  374. Type ProjectStartupOptionsDialog From Form
  375.   Type BtnOK From Button
  376.  
  377.     ' METHODS for object: ProjectStartupOptionsDialog.BtnOK
  378.     Sub Click()
  379.       Parent.ModalResult IDOK
  380.       Parent.Hide
  381.     End Sub
  382.  
  383.   End Type
  384.   Type BtnCancel From Button
  385.  
  386.     ' METHODS for object: ProjectStartupOptionsDialog.BtnCancel
  387.     Sub Click()
  388.       Parent.ModalResult IDCANCEL
  389.       Parent.Hide
  390.     End Sub
  391.  
  392.   End Type
  393.   Dim OptDefaultProj As New OptionButton
  394.   Dim OptShowDialog As New OptionButton
  395.   Dim OptNewProj As New OptionButton
  396.   Dim OptOpenProj As New OptionButton
  397.   Dim OptNoProj As New OptionButton
  398.  
  399.   ' METHODS for object: ProjectStartupOptionsDialog
  400.   Sub Execute
  401.     LoadForm
  402.     Center
  403.     SyncOptions
  404.     If ShowModal = IDOK Then 
  405.       With ProjectStartupOptions
  406.         If OptShowDialog.Value Then 
  407.           .AskOnStartup = True
  408.         Else 
  409.           .AskOnStartup = False
  410.           If OptNoProj.Value Then 
  411.             .StartupAction = .ACTION_NO_PROJECT
  412.           ElseIf OptOpenProj.Value Then 
  413.             .StartupAction = .ACTION_OPEN_PROJECT
  414.           ElseIf OptNewProj.Value Then 
  415.             .StartupAction = .ACTION_NEW_PROJECT
  416.           Else 
  417.             .StartupAction = .ACTION_DEFAULT_PROJECT
  418.           End If
  419.         End If
  420.       End With
  421.       ModuleManager.ModuleContaining(ProjectStartupOptions).Save
  422.     End If
  423.   End Sub
  424.  
  425.   Sub Resize()
  426.     Dim m, mm, l, t, w, h, effWidth As Single
  427.     m = BtnOK.Top
  428.     mm = m * 2
  429.     effWidth = IIf(ScaleWidth < 4000, 4000, ScaleWidth)
  430.     w = BtnOK.Width
  431.     l = effWidth - m - w
  432.     t = m
  433.     h = BtnOK.Height
  434.     BtnOK.Move(l, t, w, h)
  435.     t = t + h + m
  436.     BtnCancel.Move(l, t, w, h)
  437.     w = l - OptNoProj.Left - m
  438.     OptDefaultProj.Width = w
  439.     OptShowDialog.Width = w
  440.     OptNewProj.Width = w
  441.     OptOpenProj.Width = w
  442.     OptNoProj.Width = w
  443.   End Sub
  444.  
  445.   Sub SyncOptions
  446.     OptDefaultProj.Value = False
  447.     OptShowDialog.Value = False
  448.     OptNewProj.Value = False
  449.     OptOpenProj.Value = False
  450.     OptNoProj.Value = False
  451.     With ProjectStartupOptions
  452.       If .AskOnStartup Then 
  453.         OptShowDialog.Value = True
  454.       Else 
  455.         Select Case .StartupAction
  456.           Case .ACTION_NO_PROJECT
  457.             OptNoProj.Value = True
  458.           Case .ACTION_OPEN_PROJECT
  459.             OptOpenProj.Value = True
  460.           Case .ACTION_NEW_PROJECT
  461.             OptNewProj.Value = True
  462.           Case Else ' Includes .ACTION_DEFAULT_PROJECT
  463.             OptDefaultProj.Value = True
  464.         End Select
  465.       End If
  466.     End With
  467.   End Sub
  468.  
  469. End Type
  470.  
  471. Type GadgetConfigWizard From WizardMaster.Wizard
  472.   Type ToolName From WizardMaster.FrmStep
  473.     Dim TBName As New TextBox
  474.   End Type
  475.   Type ToolHintText From WizardMaster.FrmStep
  476.     Dim TBHintText As New TextBox
  477.   End Type
  478.   Type ToolBitmap From WizardMaster.FrmStep
  479.     Dim LblBitmap As New Label
  480.     Dim TBBitmap As New TextBox
  481.     Type BTNBrowse From Button
  482.  
  483.       ' METHODS for object: GadgetConfigWizard.ToolBitmap.BTNBrowse
  484.       Sub BtnBrowse_Click()
  485.         Dim open as New OpenDialog
  486.       
  487.         ' Set the title of the open dialog just before we display it.
  488.         open.Title = "Configure Tool Gadget"
  489.       
  490.         ' Set the filter to look for bitmaps
  491.         open.Filter = "Bitmap files|*.bmp|"
  492.       
  493.         ' If a filename was picked, then remember it
  494.         ' Let the picture on this wizard preview it
  495.         If open.Execute <> IDCANCEL Then 
  496.           TBBitmap.Text = open.FileName
  497.         End If
  498.       End Sub
  499.  
  500.     End Type
  501.     Type SampleBox From ObjectBox
  502.       Dim PreviewTool As New ToolGadget
  503.  
  504.       ' METHODS for object: GadgetConfigWizard.ToolBitmap.SampleBox
  505.       Sub Reposition
  506.         dim l,t,w,h as long
  507.         PreviewTool.bitmap.SetPicture Parent.wizard.TempGadget.bitmap.GetPicture
  508.       
  509.         PreviewTool.HintText = Parent.wizard.TempGadget.HintText
  510.         w = (PreviewTool.bitmap.Width + 4) * 15
  511.         If w > 4125 Then w = 4125
  512.         If w < 150 Then w = 150
  513.         h = (PreviewTool.bitmap.Height + 4) * 15
  514.         If h > 1575 Then h = 1575
  515.         If h < 150 Then h = 150
  516.         l = 2850 + ((4125 - w) / 2)
  517.         t = 2175 + ((1575 - h) / 2)
  518.         Move(l, t, w, h)
  519.         PreviewTool.Refresh
  520.         ForceLayout(True)
  521.       End Sub
  522.  
  523.     End Type
  524.     Dim BTNPreview As New Button
  525.  
  526.     ' METHODS for object: GadgetConfigWizard.ToolBitmap
  527.     Sub BTNBrowse_Click()
  528.       Dim length As Integer
  529.       Dim open as New OpenDialog
  530.     
  531.       ' Set the title of the open dialog just before we display it.
  532.       open.Title = "Configure Tool Gadget"
  533.     
  534.       ' Set the filter to look for bitmaps
  535.       open.Filter = "Bitmap files|*.bmp|"
  536.     
  537.       ' Let this selection cause a directory change
  538.       open.NoChangeDir = False
  539.     
  540.       ' If a filename was picked, then remember it
  541.       ' Let the picture on this wizard preview it
  542.       If open.Execute <> IDCANCEL Then 
  543.         TBBitmap.Text = open.FileName
  544.         BTNPreview_Click
  545.       End If
  546.     End Sub
  547.  
  548.     Sub BTNPreview_Click()
  549.       wizard.TempGadget.bitmap.LoadType = "FileBased"
  550.       wizard.TempGadget.bitmap.FileName = TBBitmap.Text
  551.       wizard.TempGadget.bitmap.LoadType = "MemoryBased"
  552.       SampleBox.Reposition
  553.     End Sub
  554.  
  555.   End Type
  556.   Dim OriginalGadget As ButtonGadget
  557.   Type TempGadget From ToolGadget
  558.     Dim PsuedoName As String
  559.   End Type
  560.   Dim BlankBitmap As New Bitmap
  561.  
  562.   ' METHODS for object: GadgetConfigWizard
  563.   Sub FinishTool
  564.     Try
  565.       OriginalGadget.HintText = TempGadget.HintText
  566.     Catch AccessDenied
  567.     End Try
  568.     If TempGadget.bitmap.ImageSize <= 0 Then 
  569.       OriginalGadget.bitmap.SetPicture BlankBitmap.GetPicture
  570.     Else 
  571.       OriginalGadget.bitmap.SetPicture TempGadget.bitmap.GetPicture
  572.     End If
  573.     OriginalGadget.Name = TempGadget.PsuedoName
  574.     OriginalGadget.Refresh
  575.     OriginalGadget.Parent.ForceLayout(True)
  576.   End Sub
  577.  
  578.   Sub InitTempGadget
  579.     TempGadget.bitmap.SetPicture OriginalGadget.bitmap.GetPicture
  580.     TempGadget.HintText = OriginalGadget.HintText
  581.     TempGadget.PsuedoName = OriginalGadget.Name
  582.     TempGadget.Refresh
  583.   End Sub
  584.  
  585.   Function TextUnload(ByVal indent As String, cmds As String) As Integer
  586.     ' Write our parent's properties, but none of ours.
  587.     TextUnload = False
  588.   End Function
  589.  
  590.   Sub ToolBitmap_ValidateDisplay(ok As Boolean)
  591.     ToolBitmap.TBBitmap.Text = TempGadget.bitmap.FileName
  592.     ToolBitmap.SampleBox.Reposition
  593.     ToolBitmap.SampleBox.ForceLayout(True)
  594.   End Sub
  595.  
  596.   Sub ToolBitmap_ValidateFinish(ok As Boolean)
  597.     dim OKToFinish as boolean
  598.     ToolBitmap_ValidateNext(OKToFinish)
  599.     If OKToFinish Then FinishTool
  600.   End Sub
  601.  
  602.   Sub ToolBitmap_ValidateNext(ok As Boolean)
  603.     TempGadget.bitmap.LoadType = "FileBased"
  604.     TempGadget.bitmap.FileName = ToolBitmap.TBBitmap.Text
  605.     TempGadget.bitmap.LoadType = "MemoryBased"
  606.   
  607.     ok = True
  608.   End Sub
  609.  
  610.   Sub ToolHintText_ValidateDisplay(ok As Boolean)
  611.     ToolHintText.TBHintText.Text = TempGadget.HintText
  612.   End Sub
  613.  
  614.   Sub ToolHintText_ValidateFinish(ok As Boolean)
  615.     dim OKToFinish as Boolean
  616.     ToolHintText_ValidateNext(OKToFinish)
  617.     If OKToFinish Then FinishTool
  618.   End Sub
  619.  
  620.   Sub ToolHintText_ValidateNext(ok As Boolean)
  621.     TempGadget.HintText = ToolHintText.TBHintText.Text
  622.     ok = True
  623.   End Sub
  624.  
  625.   Sub ToolName_ValidateDisplay(ok As Boolean)
  626.     If OriginalGadget = Nothing Then 
  627.       MessageBox.Msg("Error in GadgetConfigWizard, OriginalGadget is not connected")
  628.       ok = False
  629.     Else 
  630.       ' If not initialized yet, set the TempGadget to match the original
  631.       If Not ToolName.initialized Then 
  632.         InitTempGadget
  633.         ToolName.initialized = True
  634.       End If
  635.       ToolName.TBName.Text = TempGadget.PsuedoName
  636.       ToolName.TBName.SelStart = 0
  637.       ToolName.TBName.SelLength = 1000
  638.     End If
  639.   End Sub
  640.  
  641.   Sub ToolName_ValidateFinish(ok As Boolean)
  642.     Dim OKToFinish as Boolean
  643.     ToolName_ValidateNext(OKToFinish)
  644.     If OKToFinish Then FinishTool
  645.   End Sub
  646.  
  647.   Sub ToolName_ValidateNext(ok As Boolean)
  648.     If ToolName.TBName.Text = "" Then 
  649.       MessageBox.Msg("You must supply a name before continuing")
  650.       ok = False
  651.     Else 
  652.       TempGadget.PsuedoName = ToolName.TBName.Text
  653.       ok = True
  654.     End If
  655.   End Sub
  656.  
  657. End Type
  658.  
  659. Type ObjectEditor From ObjectEditor
  660. End Type
  661.  
  662. Type MethodEditor From MethodEditor
  663.  
  664.   ' METHODS for object: MethodEditor
  665.   Sub Help()
  666.     Envelop.Help.ShowMethodHelp(MethodName, CurObject)
  667.   End Sub
  668.  
  669. End Type
  670.  
  671. Type ObjectEditorMgr From ObjectEditorMgr
  672. End Type
  673.  
  674. Type SamplesBrowser From Form
  675.   Dim ChkBasicTraining As New CheckBox
  676.   Dim ChkAdvancedTraining As New CheckBox
  677.   Dim ChkConceptsTraining As New CheckBox
  678.   Dim ChkComponents As New CheckBox
  679.   Dim ChkApplications As New CheckBox
  680.   Dim ChkTools As New CheckBox
  681.   Dim ChkKeywordSearch As New CheckBox
  682.   Dim Label1 As New Label
  683.   Dim TxtKeySearch As New TextBox
  684.   Dim BtnShowTopics As New Button
  685.   Dim LstKeywords As New ListBox
  686.   Dim Label2 As New Label
  687.   Dim BtnLoadSample As New Button
  688.   Dim BtnHelp As New Button
  689.   Dim LstTopics As New ListBox
  690.   Dim CurrentSampleModule As ObjectModule
  691.   Dim CurrentSecondModule As ObjectModule
  692.   Dim LstSearchMaster As New ListBox
  693.   Dim DirBasicTraining As String
  694.   Dim DirAdvancedTraining As String
  695.   Dim DirConceptsTraining As String
  696.   Dim DirComponents As String
  697.   Dim DirApplications As String
  698.   Dim DirTools As String
  699.   Dim ScanCategory As String
  700.   Dim LstSampleNameIndex As New ListBox
  701.   Dim LblTopics As New Label
  702.   Dim helpfile As New HelpFile
  703.   Dim initializing As Long
  704.   Dim PopulateMasterListPunchOut As Long
  705.   Dim BtnUpdate As New Button
  706.  
  707.   ' METHODS for object: SamplesBrowser
  708.   Sub BtnHelp_Click()
  709.     ' If we have a topic selected, load it
  710.     If (LstTopics.ListIndex <> -1) Then 
  711.       Dim samplename As String
  712.       samplename = Mid(LstTopics.Text, Instr(LstTopics.Text, ":") + 1)
  713.       LoadHelp(samplename)
  714.     End If
  715.   End Sub
  716.  
  717.   Sub BtnLoadSample_Click()
  718.     ' If we have a topic selected, load it
  719.     If (LstTopics.ListIndex <> -1) Then 
  720.       Dim samplename As String
  721.       samplename = Mid(LstTopics.Text, Instr(LstTopics.Text, ":") + 1)
  722.       LoadSample(samplename)
  723.     End If
  724.   End Sub
  725.  
  726.   Sub BtnShowTopics_Click()
  727.     PopulateTopicsList(LstKeywords.Text)
  728.   End Sub
  729.  
  730.   Sub BtnUpdate_Click()
  731.     PopulateMasterList
  732.   End Sub
  733.  
  734.   Sub ChkAdvancedTraining_Click()
  735.     BtnUpdate.Enabled = True
  736.   End Sub
  737.  
  738.   Sub ChkApplications_Click()
  739.     BtnUpdate.Enabled = True
  740.   End Sub
  741.  
  742.   Sub ChkBasicTraining_Click()
  743.     BtnUpdate.Enabled = True
  744.   End Sub
  745.  
  746.   Sub ChkComponents_Click()
  747.     BtnUpdate.Enabled = True
  748.   End Sub
  749.  
  750.   Sub ChkConceptsTraining_Click()
  751.     BtnUpdate.Enabled = True
  752.   End Sub
  753.  
  754.   Sub ChkKeywordSearch_Click()
  755.     If ChkKeywordSearch.Value Then 
  756.       LblTopics.Caption = "<topic>:<sample>"
  757.       TxtKeySearch.Enabled = True
  758.       BtnShowTopics.Enabled = True
  759.       LstKeywords.Enabled = True
  760.       TxtKeySearch.SetFocus
  761.     Else 
  762.       LblTopics.Caption = "<category>:<sample>"
  763.       TxtKeySearch.Enabled = False
  764.       BtnShowTopics.Enabled = False
  765.       LstKeywords.Enabled = False
  766.     End If
  767.   
  768.     ' Need to enable the Update button
  769.     BtnUpdate.Enabled = True
  770.   End Sub
  771.  
  772.   Sub ChkTools_Click()
  773.     BtnUpdate.Enabled = True
  774.   End Sub
  775.  
  776.   Sub DoHelpEnabling()
  777.     Dim item, comma1, comma2 As Integer
  778.     Dim itemstr, filename, path, samplename, sample As String
  779.     Dim file As New File
  780.   
  781.     ' If we have a topic selected, load it
  782.     If (LstTopics.ListIndex <> -1) Then 
  783.       sample = Mid(LstTopics.Text, Instr(LstTopics.Text, ":") + 1)
  784.     Else 
  785.       Exit Sub
  786.     End If
  787.   
  788.     ' Locate the corresponding sample
  789.     For item = 0 To LstSampleNameIndex.ListCount - 1
  790.       itemstr = LstSampleNameIndex.List(item)
  791.       comma1 = Instr(itemstr, ",")
  792.       samplename = Trim(Left(itemstr, comma1 - 1))
  793.       If (samplename = sample) Then 
  794.         comma2 = Instr(comma1 + 1, itemstr, ",")
  795.         filename = Trim(Mid(itemstr, comma1 + 1, comma2 - comma1 - 1))
  796.         path = Trim(Mid(itemstr, comma2 + 1))
  797.         Exit For
  798.       End If
  799.     Next item
  800.   
  801.     ' Determine which is the most current file
  802.     ' between the ebo and eto sample files
  803.     file.FileName = path & "\" & filename & ".hlp"
  804.   
  805.     ' If the help file exists, enable the button
  806.     BtnHelp.Enabled = file.Exists
  807.   End Sub
  808.  
  809.   Function getDateTime(filename as File) As String
  810.     getDateTime = Right(filename.Date, 4) & Left(filename.Date, 6) & filename.Time
  811.   End Function
  812.  
  813.   Sub InitSampleSpy
  814.     initializing = True
  815.   
  816.     ' Set the search directories and strip off leading (..)
  817.     DirBasicTraining = Envelop.Path & "..\bootcamp\basic"
  818.     DirAdvancedTraining = Envelop.Path & "..\bootcamp\advanced"
  819.     DirConceptsTraining = Envelop.Path & "..\bootcamp\concepts"
  820.     DirComponents = Envelop.Path & "..\arsenal\parts"
  821.     DirApplications = Envelop.Path & "..\arsenal\apps"
  822.     DirTools = Envelop.Path & "..\arsenal\tools"
  823.   
  824.     ' Set all the category checkboxes to false
  825.     ChkBasicTraining.Value = 0
  826.     ChkAdvancedTraining.Value = 0
  827.     ChkConceptsTraining.Value = 0
  828.     ChkComponents.Value = 0
  829.     ChkTools.Value = 0
  830.     ChkApplications.Value = 0
  831.   
  832.     ChkKeywordSearch.Value = 0
  833.   
  834.     ' Clear the master and keyword lists
  835.     LstSearchMaster.Clear()
  836.     LstSampleNameIndex.Clear()
  837.     LstKeywords.Clear()
  838.     LstTopics.Clear()
  839.     TxtKeySearch.Text = ""
  840.   
  841.     initializing = False
  842.   
  843.   End Sub
  844.  
  845.   Sub Load
  846.     ' set the initial directories for various types of samples
  847.     InitSampleSpy
  848.     CurrentSampleModule = Nothing
  849.     PopulateMasterList
  850.   End Sub
  851.  
  852.   Sub LoadHelp(sample As String)
  853.     Dim item, comma1, comma2 As Integer
  854.     Dim itemstr, filename, path, samplename As String
  855.     Dim file As New File
  856.   
  857.     ' Locate the corresponding sample
  858.     For item = 0 To LstSampleNameIndex.ListCount - 1
  859.       itemstr = LstSampleNameIndex.List(item)
  860.       comma1 = Instr(itemstr, ",")
  861.       samplename = Trim(Left(itemstr, comma1 - 1))
  862.       If (samplename = sample) Then 
  863.         comma2 = Instr(comma1 + 1, itemstr, ",")
  864.         filename = Trim(Mid(itemstr, comma1 + 1, comma2 - comma1 - 1))
  865.         path = Trim(Mid(itemstr, comma2 + 1))
  866.         Exit For
  867.       End If
  868.     Next item
  869.   
  870.     ' Determine which is the most current file
  871.     ' between the ebo and eto sample files
  872.     path = IIf((Right(path, 1) = "\"), path, path & "\")
  873.     file.FileName = path & filename & ".hlp"
  874.   
  875.     ' Load the file if it exists, otherwise disable the button
  876.     If Not file.Exists Then 
  877.       BtnHelp.Enabled = False
  878.     Else 
  879.       helpfile.FileName = file.FileName
  880.       helpfile.Contents
  881.     End If
  882.   End Sub
  883.  
  884.   Function LoadNewer(ByVal path as string, ByVal filename as string) As Object
  885.     ' Determine which is the most current file
  886.     ' between the ebo and eto sample files
  887.     dim file As New File
  888.     dim ebodatetime As String
  889.     path = IIf((Right(path, 1) = "\"), path, path & "\")
  890.     file.FileName = path & filename & ".ebo"
  891.     If file.Exists Then 
  892.       ebodatetime = getDateTime(file)
  893.       file.FileName = path & filename & ".eto"
  894.       If file.Exists && (getDateTime(file) < ebodatetime) Then 
  895.         file.FileName = path & filename & ".ebo"
  896.       End If
  897.     Else 
  898.       file.FileName = path & filename & ".eto"
  899.     End If
  900.     LoadNewer = ModuleManager.LoadModule(file.FileName, True)
  901.   End Function
  902.  
  903.   Sub LoadSample (sample As String)
  904.     Dim item, comma1, comma2 As Integer
  905.     Dim itemstr, filename, path, samplename As String
  906.     Dim ebodatetime As String
  907.     Dim file As New File
  908.   
  909.     ' Locate the corresponding sample
  910.     For item = 0 To LstSampleNameIndex.ListCount - 1
  911.       itemstr = LstSampleNameIndex.List(item)
  912.       comma1 = Instr(itemstr, ",")
  913.       samplename = Trim(Left(itemstr, comma1 - 1))
  914.       If (samplename = sample) Then 
  915.         comma2 = Instr(comma1 + 1, itemstr, ",")
  916.         filename = Trim(Mid(itemstr, comma1 + 1, comma2 - comma1 - 1))
  917.         path = Trim(Mid(itemstr, comma2 + 1))
  918.         Exit For
  919.       End If
  920.     Next item
  921.   
  922.     ' Make sure we find a sample
  923.     If path = "" Or filename = "" Then 
  924.       InfoBox.Message("Not Found", "Sample " & sample & " not found in index.")
  925.       Exit Sub
  926.     End If
  927.   
  928.     file.FileName = path & filename & ".eto"
  929.   
  930.     ' Unload Previous Sample(s)
  931.     If CurrentSecondModule Then 
  932.       CurrentSecondModule.Unload
  933.       CurrentSecondModule = Nothing
  934.     End If
  935.     If CurrentSampleModule Then 
  936.       CurrentSampleModule.Unload
  937.       CurrentSampleModule = Nothing
  938.     End If
  939.   
  940.     If file.Exists Then 
  941.       Dim curMod as ObjectModule
  942.       curMod = ModuleManager.CurrentModule
  943.       CurrentSampleModule = LoadNewer(file.Path, file.Name)
  944.       file.FileName = file.Path & "s" & Left$(file.Name, 7) & file.Extension
  945.       If file.Exists Then 
  946.         CurrentSecondModule = LoadNewer(file.Path, file.Name)
  947.       Else 
  948.         CurrentSecondModule = Nothing
  949.       End If
  950.       ModuleManager.CurrentModule = curMod
  951.       ObjectViewer.Reset
  952.     Else 
  953.       InfoBox.Message("File not found", "Unable to load sample " & sample)
  954.     End If
  955.   
  956.   End Sub
  957.  
  958.   Sub LstKeywords_DblClick()
  959.     BtnShowTopics_Click
  960.   End Sub
  961.  
  962.   Sub LstTopics_Click()
  963.     DoHelpEnabling
  964.   End Sub
  965.  
  966.   Sub LstTopics_DblClick()
  967.     BtnLoadSample_Click
  968.   End Sub
  969.  
  970.   Sub PopulateMasterList()
  971.   
  972.     ' Clear the master and keyword lists
  973.     LstSearchMaster.Clear()
  974.     LstSampleNameIndex.Clear()
  975.     LstKeywords.Clear()
  976.     LstTopics.Clear()
  977.     TxtKeySearch.Text = ""
  978.   
  979.     ' Depending on which option is selected, populate the master list with
  980.     ' corresponding sample information
  981.     ScanCategory = ""
  982.     If ChkBasicTraining.Value Then 
  983.       ScanCategory = "Basic Training"
  984.       ScanSamples DirBasicTraining
  985.     End If
  986.     If ChkAdvancedTraining.Value Then 
  987.       ScanCategory = "Advanced Training"
  988.       ScanSamples DirAdvancedTraining
  989.     End If
  990.     If ChkConceptsTraining.Value Then 
  991.       ScanCategory = "Concepts Training"
  992.       ScanSamples DirConceptsTraining
  993.     End If
  994.     If ChkComponents.Value Then 
  995.       ScanCategory = "Components"
  996.       ScanSamples DirComponents
  997.     End If
  998.     If ChkApplications.Value Then 
  999.       ScanCategory = "Applications"
  1000.       ScanSamples DirApplications
  1001.     End If
  1002.     If ChkTools.Value Then 
  1003.       ScanCategory = "Tools"
  1004.       ScanSamples DirTools
  1005.     End If
  1006.   
  1007.     If ChkKeywordSearch.Value && LstKeywords.ListCount = 0 && ScanCategory <> "" Then 
  1008.       PostNotFoundMessage ScanCategory
  1009.     End If
  1010.   
  1011.     ' Disable the Update button to signify that no update is needed
  1012.     BtnUpdate.Enabled = False
  1013.   
  1014.   End Sub
  1015.  
  1016.   Sub PopulateTopicsList (key as string)
  1017.     Dim item, comma1, comma2, comma3 As Integer
  1018.     Dim itemstr, keypart, topicname, samplename As String
  1019.   
  1020.     ' clear the current topics list
  1021.     LstTopics.Clear()
  1022.   
  1023.     For item = 0 To LstSearchMaster.ListCount - 1
  1024.       itemstr = LstSearchMaster.List(item)
  1025.       comma1 = Instr(itemstr, ",")
  1026.       keypart = Trim(Left(itemstr, comma1 - 1))
  1027.       If (keypart = key) Then 
  1028.         comma2 = Instr(comma1 + 1, itemstr, ",")
  1029.         comma3 = Instr(comma2 + 1, itemstr, ",")
  1030.         topicname = Trim(Mid(itemstr, comma1 + 1, comma2 - comma1 - 1))
  1031.         samplename = Trim(Mid(itemstr, comma2 + 1, comma3 - comma2 - 1))
  1032.         LstTopics.AddItem(topicname & ":" & samplename)
  1033.       End If
  1034.       If (LCase(keypart) > LCase(key)) Then 
  1035.         Exit Sub
  1036.       End If
  1037.     Next item
  1038.   End Sub
  1039.  
  1040.   Sub PostNotFoundMessage (message As String)
  1041.     ' Display a message if no samples were found
  1042.     InfoBox.Message("Not Found", "No samples were found in the " & message & " category.")
  1043.   End Sub
  1044.  
  1045.   Sub ScanKwdFile(ByVal filename As String, attr As Long)
  1046.     Dim file As New TextFile
  1047.     Dim contents, samplename, key, part1, part2 As String
  1048.     Dim i, pos As Integer
  1049.   
  1050.     ' Use a TextFile object to parse path name into parts, as well
  1051.     ' as to read the contents and manipulate them into the index lists.
  1052.     file.FileName = filename
  1053.     contents = file.ContentsAsString
  1054.     samplename = ""
  1055.     Do
  1056.       pos = Instr(contents, "^M")
  1057.       If pos = 0 Then pos = Len(contents) + 1
  1058.       key = Trim$(Left$(contents, pos - 1))
  1059.       contents = Mid$(contents, pos + 2)
  1060.       If (Len(key) > 0) Then 
  1061.         ' look for colon separators in each line entry
  1062.         pos = Instr(key, ":")
  1063.         part1 = Trim(Left(key, pos - 1))
  1064.         part2 = Trim(Mid(key, pos + 1))
  1065.         If part1 = "SampleName" Then 
  1066.           LstSampleNameIndex.AddItem(part2 & "," & file.Name & "," & file.Path)
  1067.           If ChkKeywordSearch.Value Then 
  1068.             samplename = part2
  1069.           Else 
  1070.             LstTopics.AddItem(ScanCategory & ":" & part2)
  1071.             Exit Do
  1072.           End If
  1073.         Else 
  1074.           If samplename = "" Then 
  1075.             InfoBox.Message("Not Found", "Could not identify SampleName entry in keyword file: " & filename)
  1076.             Exit Sub
  1077.           End If
  1078.           If ChkKeywordSearch.Value Then 
  1079.             LstSearchMaster.AddItem(part2 & "," & part1 & "," & samplename & "," & file.Path)
  1080.             If (LstKeywords.ItemIndex(part2) = -1) Then LstKeywords.AddItem(part2)
  1081.           End If
  1082.         End If
  1083.       End If
  1084.     Loop While Len(contents) > 0
  1085.   End Sub
  1086.  
  1087.   Sub ScanSamples (path As String)
  1088.     Dim dir As New Directory
  1089.     dir.Path = path
  1090.     dir.EnumContents(Me, "ScanKwdFile", "*.kwd", True)
  1091.   End Sub
  1092.  
  1093.   Sub TxtKeySearch_Change()
  1094.     Dim newselection as Integer
  1095.   
  1096.     If TxtKeySearch.Text = "" Then 
  1097.       LstKeywords.ListIndex = -1
  1098.     Else 
  1099.       ' Search for the keyword in the keyword list and select it
  1100.       newselection = LstKeywords.FindString(TxtKeySearch.Text, -1)
  1101.   
  1102.       If (newselection <> -1) Then 
  1103.         ' Suppress keystroke that generated new selection
  1104.         LstKeywords.ListIndex = newselection
  1105.       End If
  1106.     End If
  1107.   End Sub
  1108.  
  1109. End Type
  1110.  
  1111. Type MenuSelector From Form
  1112.   Dim Label1 As New Label
  1113.   Dim btnOK As New Button
  1114.   Dim btnCancel As New Button
  1115.   Dim Label2 As New Label
  1116.   Dim optMbar As New OptionButton
  1117.   Dim optPopup As New OptionButton
  1118.   Dim cboMenus As New ObjectCombo
  1119.  
  1120.   ' METHODS for object: MenuSelector
  1121.   Sub btnCancel_Click()
  1122.     ModalResult(IDCANCEL)
  1123.     Hide
  1124.   End Sub
  1125.  
  1126.   Sub btnOK_Click()
  1127.     ModalResult(IDOK)
  1128.     Hide
  1129.   End Sub
  1130.  
  1131.   Sub optMbar_Click()
  1132.     Populate
  1133.   End Sub
  1134.  
  1135.   Sub optPopup_Click()
  1136.     Populate
  1137.   End Sub
  1138.  
  1139.   Sub Populate
  1140.     Dim name As String
  1141.     Dim i As Integer
  1142.   
  1143.     cboMenus.Clear
  1144.     If optMbar.Value = True Then 
  1145.       cboMenus.RootObject = FindObject("MenuBar")
  1146.     Else 
  1147.       cboMenus.RootObject = FindObject("PopupMenu")
  1148.     End If
  1149.   
  1150.     ' Filter out 'MenuBar' , 'PopupMenu', 'MenuTester.*'
  1151.     ' work our way up from the bottom of the list so that
  1152.     ' the indices won't be disturbed by any removals
  1153.     For i = cboMenus.ListCount - 1 To 0 Step -1
  1154.       name = cboMenus.List(i)
  1155.       If name = "MenuBar" || name = "PopupMenu" || Left$(name, 11) = "MenuTester." Then cboMenus.RemoveItem(i)
  1156.     Next i
  1157.   End Sub
  1158.  
  1159.   Sub Preload()
  1160.     LoadForm
  1161.   End Sub
  1162.  
  1163.   Sub Resize()
  1164.     Dim l As Integer
  1165.   
  1166.     cboMenus.Width = ScaleWidth - 2 * cboMenus.Left
  1167.   
  1168.     l = ScaleWidth - 60 - btnOK.Width
  1169.     btnCancel.Left = l
  1170.     btnOK.Left = l
  1171.   End Sub
  1172.  
  1173. End Type
  1174.  
  1175. Type EnvelopFont From Font
  1176. End Type
  1177.  
  1178. Type ProjectAndModuleView From IndentedList
  1179.   Dim dirty As Boolean
  1180.   Dim bitmap As New Bitmap
  1181.   Dim kIconProject As Integer
  1182.   Dim kIconModule As Integer
  1183.   Dim kIconObject As Integer
  1184.   Dim kLevelProject As Integer
  1185.   Dim kLevelModule As Integer
  1186.   Dim kLevelObject As Integer
  1187.   Property SelModule Get getSelModule Set setSelModule As ObjectModule
  1188.   Property SelObject Get getSelObject Set setSelObject As Object
  1189.  
  1190.   ' METHODS for object: ProjectAndModuleView
  1191.   Sub Click()
  1192.     If SelObject Then ObjectEditorMgr.Selection SelObject
  1193.   End Sub
  1194.  
  1195.   Sub Collapsed(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj as Object)
  1196.     Dim level As Integer
  1197.     level = ItemLevel(itemIndex)
  1198.     If level = kLevelProject Then  ' Project
  1199.       SetItemIcon(itemIndex, IIf(itemObj.IsCurrent, kIconProject + 1, kIconProject))
  1200.     ElseIf level = kLevelModule Then  ' Module
  1201.       SetItemIcon(itemIndex, IIf(itemObj.IsCurrent, kIconModule + 1, kIconModule))
  1202.     End If
  1203.   End Sub
  1204.  
  1205.   Sub DblClick()
  1206.     ObjectViewer.DblClickObject getSelObject
  1207.   End Sub
  1208.  
  1209.   Sub DestroySelectedObject()
  1210.     DestroyObject(SelObject)
  1211.     ResetObjectDestroyed(ListIndex)
  1212.   End Sub
  1213.  
  1214.   Sub DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  1215.     Parent.DragAndDrop(source, x, y, state, effect)
  1216.   End Sub
  1217.  
  1218.   Sub DragStart(o as XferData, x,y as single)
  1219.     o.ObjectRef = SelObject
  1220.     o.Drag(1)
  1221.    ' Drag and drop ends up eating the mouse up event.  Since we
  1222.     ' are doing left mouse dnd, this leaves the list in a state where it
  1223.     ' is expecting a mouse up.  
  1224.     ' We will explicitly send a lbutton up message to the list's hwnd
  1225.     ' to fix the problem.
  1226.     SendMessage(hWnd, User32.WM_LBUTTONUP, 0, 0)
  1227.   End Sub
  1228.  
  1229.   Sub Expand(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj as Object)
  1230.     Dim level, oldCount As Integer
  1231.     level = ItemLevel(itemIndex)
  1232.     oldCount = ListCount
  1233.     If level = kLevelProject Then  ' Project
  1234.       ExpandProject(itemIndex, itemObj)
  1235.       If oldCount < ListCount Then 
  1236.         SetItemIcon(itemIndex, IIf(itemObj.IsCurrent, kIconProject + 3, kIconProject + 2))
  1237.       End If
  1238.     ElseIf level = kLevelModule Then  ' Module
  1239.       ExpandModule(itemIndex, itemObj)
  1240.       If oldCount < ListCount Then 
  1241.         SetItemIcon(itemIndex, IIf(itemObj.IsCurrent, kIconModule + 3, kIconModule + 2))
  1242.       End If
  1243.     End If
  1244.   End Sub
  1245.  
  1246.   Sub ExpandModule(ByVal index as Integer, m as ObjectModule)
  1247.     Dim i, i1, n as integer
  1248.     dim o as Object
  1249.     dim idx as Integer
  1250.     dim icon as Integer
  1251.     dim pstr as String
  1252.   
  1253.     ' Add in all the module's objects
  1254.     i1 = index + 1
  1255.     n = m.StaticCount - 1
  1256.     Sorted = True
  1257.     For i = 0 To n
  1258.       o = m.StaticObject(i)
  1259.       pstr = o
  1260.       icon = IIf(IsPrototype(o), kIconObject + 1, kIconObject)
  1261.       idx = InsertItem(pstr, icon, kLevelObject, i1)
  1262.       SetItemObject(idx, o)
  1263.     Next i
  1264.     Sorted = False
  1265.   
  1266.   End Sub
  1267.  
  1268.   Function firstEntryInSet(ByVal idx as Integer) As Integer
  1269.     Dim i, level, targetLevel as Integer
  1270.     targetLevel = ItemLevel(idx)
  1271.   
  1272.     For i = idx - 1 To 0 Step -1
  1273.       level = ItemLevel(i)
  1274.       If level <> targetLevel Then 
  1275.         firstEntryInSet = i + 1
  1276.         Exit Function
  1277.       End If
  1278.     Next i
  1279.     firstEntryInSet = 0
  1280.   
  1281.   End Function
  1282.  
  1283.   Function getSelModule As ObjectModule
  1284.     Dim m as ObjectModule
  1285.     Dim i, l as long
  1286.     Dim o as Object
  1287.     i = ListIndex
  1288.     If (i >= 0) Then 
  1289.       l = ItemLevel(i)
  1290.       o = ItemObject(i)
  1291.       If l = kLevelModule Then 
  1292.         m = o
  1293.       ElseIf l = kLevelObject Then 
  1294.         m = ModuleManager.ModuleContaining(o)
  1295.       Else  ' Project
  1296.         m = o.CurrentModule
  1297.       End If
  1298.     Else 
  1299.       m = ModuleManager.CurrentModule
  1300.     End If
  1301.     getSelModule = m
  1302.   End Function
  1303.  
  1304.   Function getSelObject As Object
  1305.     Dim i as long
  1306.     i = ListIndex
  1307.     If (i >= 0) && (ItemLevel(i) = kLevelObject) Then 
  1308.       getSelObject = ItemObject(i)
  1309.     Else 
  1310.       getSelObject = Nothing
  1311.     End If
  1312.   End Function
  1313.  
  1314.   Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  1315.     Dim idx, i, letter, stopidx As Integer
  1316.     If (keyCode = VK_F1) Then 
  1317.       ObjectViewer.Help
  1318.     ElseIf (keyCode = VK_DELETE) Then 
  1319.       Dim level As Integer
  1320.       idx = ListIndex
  1321.       If idx = -1 Then Exit Sub ' bail if nothing selected in my list.
  1322.       level = ItemLevel(idx)
  1323.       If level = kLevelProject Then  ' Close Project
  1324.         ObjectViewer.CloseProject_Click
  1325.       ElseIf level = kLevelModule Then  ' Unload Module
  1326.         ObjectViewer.UnloadModule_Click
  1327.       Else ' assume delete of object
  1328.         EnvelopForm.DeleteObject_Click
  1329.       End If
  1330.     End If
  1331.   
  1332.     ' If not on object, bail
  1333.     If ListIndex = -1 Or ItemLevel(ListIndex) <> kLevelObject Then 
  1334.       Exit Sub
  1335.     End If
  1336.   
  1337.     ' If the next guy is not also an object, go to first object in
  1338.     ' this module.
  1339.     If ItemLevel(ListIndex + 1) <> kLevelObject Then 
  1340.       idx = firstEntryInSet(ListIndex)
  1341.     Else 
  1342.       idx = ListIndex + 1
  1343.     End If
  1344.   
  1345.     ' If the next guy in the list starts with our target, we're
  1346.     ' done. If he starts with a letter less than our target, look
  1347.     ' down in the list. If he starts with a letter greater than
  1348.     ' our target, look up.
  1349.     letter = Asc(UCase(Left(ItemString(idx), 1)))
  1350.     If letter = keyCode Then 
  1351.       ListIndex = idx
  1352.       Exit Sub
  1353.     ElseIf letter < keyCode Then 
  1354.       idx = idx + 1
  1355.     ElseIf letter > keyCode Then 
  1356.       idx = firstEntryInSet(ListIndex)
  1357.     End If
  1358.   
  1359.     ' Look through the list
  1360.     stopidx = ListCount - 1
  1361.     For i = idx To stopidx
  1362.       letter = Asc(UCase(Left(ItemString(i), 1)))
  1363.       If letter = keyCode Then 
  1364.         ListIndex = i
  1365.         Exit Sub
  1366.       ElseIf letter > keyCode Then 
  1367.         Exit Sub
  1368.       End If
  1369.     Next i
  1370.   
  1371.   End Sub
  1372.  
  1373.   Sub MoveSelectedObject()
  1374.     Dim o as Object
  1375.     o = SelObject
  1376.     If o Then 
  1377.       AttachObject(o)
  1378.       RemoveItem(ListIndex)
  1379.       SelectObject(o, True)
  1380.     End If
  1381.   End Sub
  1382.  
  1383.   Sub RenameSelectedObject(nm as String)
  1384.     Dim o as Object
  1385.     o = SelObject
  1386.     If o Then 
  1387.       If TypeOf o Is Form Then 
  1388.         ' This will keep the Caption in sync.
  1389.         o.Name = nm
  1390.       Else 
  1391.         RenameObject(o, nm)
  1392.       End If
  1393.       SetItemObject(ListIndex, o)
  1394.       SetItemString(ListIndex, o)
  1395.     End If
  1396.   End Sub
  1397.  
  1398.   Sub ResetItemIcons
  1399.     Dim i, n, l as long
  1400.     Dim icon as integer
  1401.     Dim o as Object
  1402.   
  1403.     n = ListCount - 1
  1404.     For i = 0 To n
  1405.       l = ItemLevel(i)
  1406.       o = ItemObject(i)
  1407.       If l = kLevelObject Then 
  1408.         icon = IIf(IsPrototype(o), kIconObject + 1, kIconObject)
  1409.         SetItemIcon(i, icon)
  1410.       Else 
  1411.         icon = IIf(ItemIsExpanded(i), 2, 0) + IIf(o.IsCurrent, 1, 0)
  1412.         If l = kLevelProject Then 
  1413.           SetItemIcon(i, icon + kIconProject)
  1414.         ElseIf l = kLevelModule Then 
  1415.           SetItemIcon(i, icon + kIconModule)
  1416.         End If
  1417.       End If
  1418.     Next i
  1419.   End Sub
  1420.  
  1421.   Sub ResetModuleString(m as ObjectModule)
  1422.     Dim i, n as Integer
  1423.     Dim o As Object
  1424.   
  1425.     ' Find the module entry in question (all if m = Nothing)
  1426.     n = ListCount - 1
  1427.     For i = 0 To n
  1428.       o = ItemObject(i)
  1429.       If ItemLevel(i) = kLevelModule && (Not m || o = m) Then 
  1430.         ' Set the item to show the correct module name
  1431.         SetItemString(i, o.DisplayName)
  1432.         If m Then Exit Sub
  1433.       End If
  1434.     Next i
  1435.   End Sub
  1436.  
  1437.   Sub ResetNewObject(newObj As Object)
  1438.     SelectObject(newObj, True)
  1439.   End Sub
  1440.  
  1441.   Sub ResetObjectDestroyed(ByVal selIndex As Integer)
  1442.     ' Cull items whose object has been destroyed, while trying to keep the
  1443.     ' selected item "near" where it was.
  1444.     Dim i, oldCount As Integer
  1445.   
  1446.     ' Remove items whose object no longer exists
  1447.     i = 0
  1448.     While i < ListCount ' Can't cache list count for this loop
  1449.       If ItemObject(i) = Nothing Then 
  1450.         oldCount = ListCount
  1451.         If ItemIsExpanded(i) Then CollapseItem(i)
  1452.         RemoveItem(i)
  1453.         ' Adjust selIndex if removed items were above here.
  1454.         If i < selIndex Then selIndex = selIndex - (oldCount - ListCount)
  1455.       Else 
  1456.         ' Only increment i when we don't remove any items
  1457.         i = i + 1
  1458.       End If
  1459.     Wend
  1460.   
  1461.     ' Ok, fix up the selection now. If selIndex is past the end of the list,
  1462.     ' just make it the last item. Otherwise leave it.
  1463.     If selIndex >= ListCount Then selIndex = ListCount - 1
  1464.     ListIndex = selIndex
  1465.   End Sub
  1466.  
  1467.   Sub SelectObject(o As Object, ByVal collapse As Boolean)
  1468.     Dim i, n as Integer
  1469.     Dim m as ObjectModule
  1470.   
  1471.     If hWnd = 0 Then Exit Sub
  1472.     If Not o Then 
  1473.       ListIndex = -1
  1474.       Exit Sub
  1475.     End If
  1476.     m = ModuleManager.ModuleContaining(o)
  1477.   
  1478.     ' Find list entry for the module header, bail if not found.
  1479.     i = FindModuleIndex(m, False)
  1480.     If i = -1 Then 
  1481.       ListIndex = -1
  1482.       Exit Sub
  1483.     End If
  1484.   
  1485.     ' If given the hint, collapse before expanding.
  1486.     If collapse Then CollapseItem(i)
  1487.   
  1488.     ' Expand the module -- may change ListCount, so update cached 'n'
  1489.     ExpandItem(i) : n = ListCount
  1490.   
  1491.     ' Paw through them to find the object in question
  1492.     i = i + 1 ' advance off of module header
  1493.     While ItemObject(i) <> o And i < n
  1494.       i = i + 1
  1495.     Wend
  1496.     ListIndex = IIf(i < n, i, -1)
  1497.   End Sub
  1498.  
  1499.   Sub setSelModule(m As ObjectModule)
  1500.     ListIndex = FindModuleIndex(m, True)
  1501.   End Sub
  1502.  
  1503.   Sub setSelObject(o As Object)
  1504.     SelectObject(o, False)
  1505.   End Sub
  1506.  
  1507.   Sub setSelProject(p As Project)
  1508.     ListIndex = FindProjectIndex(p)
  1509.   End Sub
  1510.  
  1511.   Function TextUnload(ByVal indent As String, cmds As String) As Integer
  1512.     cmds = cmds & TextFieldUnload(Me, indent, "kIconProject")
  1513.     cmds = cmds & TextFieldUnload(Me, indent, "kIconModule")
  1514.     cmds = cmds & TextFieldUnload(Me, indent, "kIconObject")
  1515.     cmds = cmds & TextFieldUnload(Me, indent, "kLevelProject")
  1516.     cmds = cmds & TextFieldUnload(Me, indent, "kLevelModule")
  1517.     cmds = cmds & TextFieldUnload(Me, indent, "kLevelObject")
  1518.     TextUnload = False
  1519.   End Function
  1520.  
  1521. End Type
  1522.  
  1523. Type Debug From Debug
  1524.  
  1525.   ' METHODS for object: Debug
  1526.   Sub Help()
  1527.     Envelop.Help.ShowTopicHelp("Debug_Window")
  1528.   End Sub
  1529.  
  1530. End Type
  1531.  
  1532. Type SourceIterator From SourceIterator
  1533. End Type
  1534.  
  1535. Type ApplicationEditor From ObjectEditor
  1536.   Property Visible Get getVisible Set setVisible As Boolean
  1537.   Type form From Form
  1538.     Dim LblApp As New Label
  1539.     Dim CBApps As New ObjectCombo
  1540.     Dim BtnNewApp As New Button
  1541.     Dim LblMainForm As New Label
  1542.     Dim CBForms As New ObjectCombo
  1543.     Dim LblEXE As New Label
  1544.     Dim TEEXE As New TextBox
  1545.     Dim BtnBrowseEXE As New Button
  1546.     Dim LblSplash As New Label
  1547.     Dim TESplash As New TextBox
  1548.     Dim BtnBrowseSplash As New Button
  1549.     Dim LblModules As New Label
  1550.     Dim LstModules As New ListBox
  1551.     Dim BtnWriteEXE As New Button
  1552.     Dim ChkNoMainForm As New CheckBox
  1553.     Dim BtnAddModule As New Button
  1554.     Dim BtnDelModule As New Button
  1555.  
  1556.     ' METHODS for object: ApplicationEditor.form
  1557.     Sub BtnAddModule_Click()
  1558.       Dim r as long
  1559.       r = InputDialog.Execute("Add Module", "Enter name of module to load:", "")
  1560.       If r = IDOK Then 
  1561.         Dim i as integer
  1562.         i = LstModules.InsertItem(InputDialog.Text, LstModules.ListIndex + 1)
  1563.         LstModules.SetFocus
  1564.         LstModules.ListIndex = i
  1565.       End If
  1566.     End Sub
  1567.  
  1568.     Sub BtnBrowseEXE_Click()
  1569.       Dim a as Application
  1570.       a = CBApps.SelObject
  1571.       If a Then 
  1572.         Dim openDlg as new OpenDialog
  1573.         openDlg.DefaultExtension = "exe"
  1574.         openDlg.FileMustExist = False
  1575.         openDlg.FileName = a.EXEName
  1576.         openDlg.Filter = "EXE files (*.exe)|*.exe|All files (*.*)|*.*|"
  1577.         openDlg.InitialDir = a.Path
  1578.         openDlg.NoChangeDir = True
  1579.         openDlg.Title = "Choose application EXE file"
  1580.         If openDlg.Execute = IDOK Then 
  1581.           TEEXE.Text = openDlg.FileName
  1582.         End If
  1583.       End If
  1584.     End Sub
  1585.  
  1586.     Sub BtnBrowseSplash_Click()
  1587.       Dim a as Application
  1588.       a = CBApps.SelObject
  1589.       If a Then 
  1590.         Dim openDlg as new OpenDialog
  1591.         openDlg.DefaultExtension = "bmp"
  1592.         openDlg.FileMustExist = True
  1593.         openDlg.FileName = ""
  1594.         openDlg.Filter = "Bitmap files (*.bmp)|*.bmp|All files (*.*)|*.*|"
  1595.         openDlg.InitialDir = a.Path
  1596.         openDlg.NoChangeDir = True
  1597.         openDlg.Title = "Choose splash-screen bitmap file"
  1598.         If openDlg.Execute = IDOK Then 
  1599.           TESplash.Text = openDlg.FileName
  1600.         End If
  1601.       End If
  1602.     End Sub
  1603.  
  1604.     Sub BtnDelModule_Click()
  1605.       Dim i, n as integer
  1606.       i = LstModules.ListIndex
  1607.       If i >= 0 Then 
  1608.         n = LstModules.RemoveItem(i)
  1609.         If i = n Then i = i - 1
  1610.         LstModules.ListIndex = i
  1611.       End If
  1612.     End Sub
  1613.  
  1614.     Sub BtnNewApp_Click()
  1615.       Dim a as Application
  1616.       Dim r as long
  1617.       r = InputDialog.Execute("New Application", "Enter name for new application:", UniqueObjectNameFromString("Application"))
  1618.       If r = IDOK Then 
  1619.         a = CopyObject(Application, InputDialog.Text)
  1620.         CBApps.Reset
  1621.         CBApps.SelObject = a
  1622.         CBForms.SetFocus
  1623.       End If
  1624.     End Sub
  1625.  
  1626.     Sub BtnWriteEXE_Click()
  1627.       Dim a as Application
  1628.       a = CBApps.SelObject
  1629.       If a Then 
  1630.         a.MainForm = CBForms.SelObject
  1631.         a.EXEFileName = TEEXE.Text
  1632.         a.SplashFileName = TESplash.Text
  1633.         a.ModulePath = FormatModulePath()
  1634.         a.WriteEXE
  1635.       End If
  1636.     End Sub
  1637.  
  1638.     Sub CBApps_Click()
  1639.       Dim a as Application
  1640.       Dim appName as String
  1641.       a = CBApps.SelObject
  1642.       appName = a
  1643.       If Len(appName) = 0 || a = Application Then 
  1644.         Caption = "Application"
  1645.       Else 
  1646.         Caption = "Application: " & appName
  1647.       End If
  1648.     
  1649.       If a Then 
  1650.         CBForms.Reset
  1651.         CBForms.SelObject = a.MainForm
  1652.         TEEXE.Text = a.EXEFileName
  1653.         TESplash.Text = a.SplashFileName
  1654.         InitModulePath(a)
  1655.       Else 
  1656.         CBForms.SelObject = Nothing
  1657.         TEEXE.Text = ""
  1658.         TESplash.Text = ""
  1659.         LstModules.Clear
  1660.       End If
  1661.     
  1662.       If CBForms.SelObject = Nothing Then 
  1663.         ChkNoMainForm.Value = 1
  1664.       Else 
  1665.         ChkNoMainForm.Value = 0
  1666.       End If
  1667.     End Sub
  1668.  
  1669.     Sub CBApps_DropDown()
  1670.       Dim a As Object
  1671.       a = CBApps.SelObject
  1672.       CBApps.Reset
  1673.       CBApps.SelObject = a
  1674.     End Sub
  1675.  
  1676.     Sub CBForms_Click()
  1677.       If CBForms.SelObject Then 
  1678.         ChkNoMainForm.Value = 0
  1679.       Else 
  1680.         ChkNoMainForm.Value = 1
  1681.       End If
  1682.     End Sub
  1683.  
  1684.     Sub CBForms_DropDown()
  1685.       Dim f As Object
  1686.       f = CBForms.SelObject
  1687.       CBForms.Reset
  1688.       CBForms.SelObject = f
  1689.     End Sub
  1690.  
  1691.     Sub ChkNoMainForm_Click()
  1692.       If ChkNoMainForm.Value && CBForms.SelObject Then 
  1693.         CBForms.SelObject = Nothing
  1694.       ElseIf ChkNoMainForm.Value = False && CBForms.SelObject = Nothing Then 
  1695.         CBForms.ListIndex = 0
  1696.       End If
  1697.     End Sub
  1698.  
  1699.     Function DetailedEdit(a As Object) As Long
  1700.       If a Then 
  1701.         LoadForm
  1702.         CBApps.Reset
  1703.         CBForms.Reset
  1704.         CBApps.SelObject = a
  1705.         BringToTop
  1706.       End If
  1707.       DetailedEdit = 0
  1708.     End Function
  1709.  
  1710.     Function FormatModulePath() As String
  1711.       Dim i, n as integer
  1712.       Dim ml as string
  1713.     
  1714.       ml = ""
  1715.       n = LstModules.ListCount - 1
  1716.       For i = 0 To n
  1717.         If i Then ml = ml & ";"
  1718.         ml = ml & LstModules.List(i)
  1719.       Next i
  1720.     
  1721.       FormatModulePath = ml
  1722.     
  1723.     End Function
  1724.  
  1725.     Sub InitModulePath(a as Application)
  1726.       Dim i, pos as integer
  1727.       Dim m, ml as string
  1728.       LstModules.Clear
  1729.       ml = a.ModulePath
  1730.       Do
  1731.         pos = Instr(ml, ";")
  1732.         If pos > 0 Then 
  1733.           m = Left(ml, pos - 1)
  1734.           ml = Mid(ml, pos + 1)
  1735.         Else 
  1736.           m = ml
  1737.         End If
  1738.         If Len(m) > 0 Then LstModules.AddItem m
  1739.       Loop While pos > 0
  1740.     End Sub
  1741.  
  1742.     Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  1743.       If (keyCode = VK_F1) Then Envelop.Help.ShowTopicHelp("Application_Editor")
  1744.     End Sub
  1745.  
  1746.     Sub Load
  1747.       CBApps.Height = 1500
  1748.       CBApps.ListIndex = 0
  1749.       CBForms.Height = 1500
  1750.       CBApps.Reset
  1751.       CBForms.Reset
  1752.     End Sub
  1753.  
  1754.     Sub LstModules_KeyDown(keyCode As Integer, ByVal shift As Integer)
  1755.       If keyCode = VK_BACK Then 
  1756.         BtnDelModule_Click
  1757.       ElseIf keyCode = VK_INSERT Then 
  1758.         BtnAddModule_Click
  1759.       End If
  1760.     End Sub
  1761.  
  1762.     Sub Resize
  1763.       dim swidth, sheight as single
  1764.       dim m, mm, w, lh, x1, x2, y as single
  1765.       swidth = LblApp.Width + (2 * BtnNewApp.Width) + 300 ' m5 = 300
  1766.       If swidth < ScaleWidth Then swidth = ScaleWidth
  1767.       m = 60 : mm = 120
  1768.       x1 = LblApp.Width + mm
  1769.       x2 = swidth - BtnNewApp.Width - m
  1770.       w = x2 - x1 - mm
  1771.       CBApps.Width = w
  1772.       BtnNewApp.Left = x2
  1773.     
  1774.       CBForms.Width = w
  1775.       ChkNoMainForm.Left = x2
  1776.     
  1777.       TEEXE.Width = w
  1778.       BtnBrowseEXE.Left = x2
  1779.     
  1780.       TESplash.Width = w
  1781.       BtnBrowseSplash.Left = x2
  1782.     
  1783.       y = TESplash.Top + TESplash.Height + mm
  1784.       sheight = y + 1200
  1785.       If sheight < ScaleHeight Then sheight = ScaleHeight
  1786.       lh = sheight - y - m
  1787.       LstModules.Move(x1, y, w, lh)
  1788.       BtnAddModule.Left = x2
  1789.       BtnDelModule.Left = x2
  1790.     
  1791.       y = sheight - BtnWriteEXE.Height - m
  1792.       BtnWriteEXE.Move(x2, y, BtnWriteEXE.Width, BtnWriteEXE.Height)
  1793.       Refresh
  1794.     End Sub
  1795.  
  1796.   End Type
  1797.  
  1798.   ' METHODS for object: ApplicationEditor
  1799.   Sub BringToTop
  1800.     form.BringToTop
  1801.   End Sub
  1802.  
  1803.   Function DetailedEdit(a As Object) As Long
  1804.     If Not a || (TypeOf a Is Application) Then 
  1805.       DetailedEdit = form.DetailedEdit(a)
  1806.     End If
  1807.   End Function
  1808.  
  1809.   Function getVisible As Boolean
  1810.     getVisible = form.Visible
  1811.   End Function
  1812.  
  1813.   Sub Hide
  1814.     form.Hide
  1815.   End Sub
  1816.  
  1817.   Sub setVisible(vis As Boolean)
  1818.     form.Visible = vis
  1819.   End Sub
  1820.  
  1821.   Sub Show
  1822.     form.Show
  1823.   End Sub
  1824.  
  1825. End Type
  1826.  
  1827. Type EnvelopScreenLayout From ScreenLayout
  1828.  
  1829.   ' METHODS for object: EnvelopScreenLayout
  1830.   Sub SaveExplicitWindows()
  1831.     ' This method is overridden to get certain windows saved explicitly.
  1832.     SaveExplicitWindow("Form")
  1833.     SaveExplicitWindow("EnvelopForm")
  1834.     SaveExplicitWindow("MethodEditor")
  1835.     SaveExplicitWindow("PropertyEditor")
  1836.     SaveExplicitWindow("Debug")
  1837.     SaveExplicitWindow("ObjectViewer")
  1838.     SaveExplicitWindow("SourceSearcher")
  1839.     SaveExplicitWindow("MenuEdit")
  1840.     SaveExplicitWindow("ApplicationEditor.form")
  1841.     SaveExplicitWindow("WorkSet.WorkSetForm")
  1842.     SaveExplicitWindow("GroupEditor.EditorForm")
  1843.     SaveExplicitWindow("ToolPalette")
  1844.     SaveExplicitWindow("ControlTools.Palette")
  1845.     SaveExplicitWindow("ObjectBoxEditor.ObjBoxForm")
  1846.     SaveExplicitWindow("SamplesBrowser")
  1847.   End Sub
  1848.  
  1849. End Type
  1850.  
  1851. Type WinDebug From WinDebug
  1852. End Type
  1853.  
  1854. Type ObjectViewer From Form
  1855.   Type ProjectView From ProjectAndModuleView
  1856.     Property CurrProjIndex Get getCurrProjIndex As Long
  1857.     Property SelProject Get getSelProject Set setSelProject As Project
  1858.  
  1859.     ' METHODS for object: ObjectViewer.ProjectView
  1860.     Sub ExpandProject(ByVal index as Integer, p as Project)
  1861.       Dim i, n as integer
  1862.       dim m, cm as ObjectModule
  1863.       dim idx as Integer
  1864.       dim icon as Integer
  1865.       dim pstr as String
  1866.     
  1867.       ' Add in all the project's modules
  1868.       idx = index
  1869.       n = p.ModuleCount - 1
  1870.       cm = ModuleManager.CurrentModule
  1871.       For i = 0 To n
  1872.     
  1873.         m = p.Module(i)
  1874.         If m = cm Then 
  1875.           icon = kIconModule + 1
  1876.         Else 
  1877.           icon = kIconModule
  1878.         End If
  1879.         pstr = m.DisplayName
  1880.         idx = InsertItem(pstr, icon, kLevelModule, idx + 1)
  1881.     
  1882.         SetItemCanExpand(idx, 1)
  1883.         SetItemObject(idx, m)
  1884.       Next i
  1885.     
  1886.     End Sub
  1887.  
  1888.     Function FindModuleIndex(m As ObjectModule, ByVal collapse As Boolean) As Long
  1889.       Dim p As Project
  1890.       Dim m_i, p_i, n, l As Long
  1891.     
  1892.       ' First, try to find the module in the current project.
  1893.       p = ProjectManager.CurrentProject
  1894.       If Not p Then p = ProjectManager.FirstProjectContainingModule(m)
  1895.     
  1896.       If p Then 
  1897.         m_i = p.ModuleIndex(m)
  1898.         If m_i >= 0 Then 
  1899.           p_i = FindProjectIndex(p)
  1900.           If collapse Then CollapseItem(p_i)
  1901.           If Not ItemIsExpanded(p_i) Then ExpandItem(p_i)
  1902.           m_i = p_i + m_i + 1
  1903.           ' m_i is now a lower-bound for where we might find the module.
  1904.           ' If not collapsing/expanding the project, we have to search.
  1905.           If collapse Then 
  1906.             FindModuleIndex = m_i
  1907.             Exit Function
  1908.           End If
  1909.           n = ListCount
  1910.           While (m_i < n)
  1911.             l = ItemLevel(m_i)
  1912.             If l = kLevelProject Then  ' left the project we were searching
  1913.               FindModuleIndex = -1
  1914.               Exit Function
  1915.             ElseIf l = kLevelModule && ItemObject(m_i) = m Then  ' found it
  1916.               FindModuleIndex = m_i
  1917.               Exit Function
  1918.             End If
  1919.             m_i = m_i + 1
  1920.           Wend
  1921.         End If
  1922.       End If
  1923.       FindModuleIndex = -1
  1924.     End Function
  1925.  
  1926.     Function FindProjectIndex(p As Project) As Long
  1927.       If p Then 
  1928.         Dim i, n as long
  1929.         n = ListCount - 1
  1930.         For i = 0 To n
  1931.           If ItemLevel(i) = kLevelProject && ItemObject(i) = p Then 
  1932.             FindProjectIndex = i
  1933.             Exit Function
  1934.           End If
  1935.         Next i
  1936.       End If
  1937.       FindProjectIndex = -1
  1938.     End Function
  1939.  
  1940.     Function getCurrProjIndex As Long
  1941.       Dim i, n as long
  1942.       Dim cp as Project
  1943.     
  1944.       cp = ProjectManager.CurrentProject
  1945.       n = ListCount - 1
  1946.     
  1947.       For i = 0 To n
  1948.         If ItemLevel(i) = kLevelProject && ItemObject(i) = cp Then 
  1949.           getCurrProjIndex = i
  1950.           Exit Function
  1951.         End If
  1952.       Next i
  1953.     
  1954.     End Function
  1955.  
  1956.     Function getSelProject As Project
  1957.       Dim p as Project
  1958.       Dim i as long
  1959.       i = ListIndex
  1960.       If (i >= 0) Then 
  1961.         While (ItemLevel(i) > kLevelProject) : i = i - 1 : Wend
  1962.         p = ItemObject(i)
  1963.       End If
  1964.       getSelProject = p
  1965.     End Function
  1966.  
  1967.     Sub MakeSelItemCurrent()
  1968.       Dim p as Project
  1969.       p = SelProject
  1970.       If p Then 
  1971.         Dim m as ObjectModule
  1972.         ProjectManager.CurrentProject = p
  1973.         m = SelModule
  1974.         If m Then p.CurrentModule = m
  1975.         ResetItemIcons
  1976.       End If
  1977.     End Sub
  1978.  
  1979.     Sub Reset()
  1980.       Dim i as Integer
  1981.       Dim inherited Strictly As IndentedList
  1982.       inherited = Me
  1983.     
  1984.       ' Clear out the list
  1985.       Clear
  1986.     
  1987.       ' Add in all the open projects
  1988.       For i = 0 To ProjectManager.ProjectCount - 1
  1989.         dim p as Project
  1990.         dim index as Integer
  1991.         dim icon as Integer
  1992.         dim pstr as String
  1993.     
  1994.         p = ProjectManager.Project(i)
  1995.         If p = ProjectManager.CurrentProject Then 
  1996.           icon = kIconProject + 1
  1997.         Else 
  1998.           icon = kIconProject
  1999.         End If
  2000.         pstr = p & IIf(p.ProjectFileName <> "", " (" & p.ProjectFileName & ")", "")
  2001.         index = InsertItem(pstr, icon, 0, i)
  2002.     
  2003.         SetItemCanExpand(index, 1)
  2004.         SetItemObject(index, p)
  2005.       Next i
  2006.     
  2007.       ' Select the current project and expand it
  2008.       SelProject = ProjectManager.CurrentProject
  2009.       ExpandItem(ListIndex)
  2010.     
  2011.       ' Invoke my inherited reset method.
  2012.       inherited.Reset
  2013.     
  2014.       ObjectViewer.ViewProject_Enable = ListCount > 0
  2015.     
  2016.       dirty = False
  2017.     End Sub
  2018.  
  2019.     Sub ResetProject(p As Project, expandCurrMod As Boolean)
  2020.       Reset
  2021.       SelProject = p
  2022.       CollapseItem(ListIndex)
  2023.       ExpandItem(ListIndex)
  2024.       If expandCurrMod Then 
  2025.         SelModule = p.CurrentModule
  2026.         ExpandItem(ListIndex)
  2027.       End If
  2028.     End Sub
  2029.  
  2030.     Sub ResetProjectString(p as Project)
  2031.       Dim i, n as Integer
  2032.       Dim o As Object
  2033.     
  2034.       ' Find the project entry in question (all if p = Nothing)
  2035.       n = ListCount - 1
  2036.       For i = 0 To n
  2037.         o = ItemObject(i)
  2038.         If ItemLevel(i) = kLevelProject && (Not p || o = p) Then 
  2039.           ' Set the item to show the correct project information
  2040.           SetItemString(i, o & IIf(o.ProjectFileName <> "", " (" & o.ProjectFileName & ")", ""))
  2041.           If p Then Exit Sub
  2042.         End If
  2043.       Next i
  2044.     End Sub
  2045.  
  2046.     Sub setSelProject(p As Project)
  2047.       ListIndex = FindProjectIndex(p)
  2048.     End Sub
  2049.  
  2050.     Function TextUnload(ByVal indent As String, cmds As String) As Integer
  2051.       ' Write our parent's properties, but none of ours.
  2052.       TextUnload = False
  2053.     End Function
  2054.  
  2055.   End Type
  2056.   Type HierView From ObjectHierarchy
  2057.     Dim dirty As Boolean
  2058.  
  2059.     ' METHODS for object: ObjectViewer.HierView
  2060.     Sub Click()
  2061.       If SelObject Then ObjectEditorMgr.Selection SelObject
  2062.     End Sub
  2063.  
  2064.     Sub DblClick()
  2065.       ObjectViewer.DblClickObject SelObject
  2066.     End Sub
  2067.  
  2068.     Sub DragAndDrop(source As XferData, x,y As Single, state As OleDropState, effect As OleDropEffect)
  2069.       Parent.DragAndDrop(source, x, y, state, effect)
  2070.     End Sub
  2071.  
  2072.     Sub DragStart(o as XferData, x,y as single)
  2073.       o.ObjectRef = SelObject
  2074.       o.Drag(1)
  2075.       ' Drag and drop ends up eating the mouse up event.  Since we
  2076.       ' are doing left mouse dnd, this leaves the list in a state where it
  2077.       ' is expecting a mouse up.  
  2078.       ' We will explicitly send a lbutton up message to the list's hwnd
  2079.       ' to fix the problem.
  2080.       SendMessage(hWnd, User32.WM_LBUTTONUP, 0, 0)
  2081.     End Sub
  2082.  
  2083.     Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  2084.       If (keyCode = VK_F1) Then 
  2085.         ObjectViewer.Help
  2086.       ElseIf (keyCode = VK_DELETE) Then 
  2087.         EnvelopForm.DeleteObject_Click
  2088.       End If
  2089.     End Sub
  2090.  
  2091.     Sub MakeSelItemCurrent()
  2092.       If SelObject Then 
  2093.         ModuleManager.CurrentModule = ModuleManager.ModuleContaining(SelObject)
  2094.       End If
  2095.     End Sub
  2096.  
  2097.     Sub MoveSelectedObject()
  2098.       Dim o as Object
  2099.       o = SelObject
  2100.       If o Then AttachObject(o)
  2101.     End Sub
  2102.  
  2103.     Sub RenameSelectedObject(nm as String)
  2104.       Dim o as Object
  2105.       o = SelObject
  2106.       If TypeOf o Is Form Then 
  2107.         ' This will keep the Caption in sync.
  2108.         o.Name = nm
  2109.       Else 
  2110.         RenameObject(o, nm)
  2111.       End If
  2112.       Refresh
  2113.     End Sub
  2114.  
  2115.     Sub Reset()
  2116.       Dim P Strictly As ObjectHierarchy
  2117.       P = Me
  2118.       P.Reset
  2119.       dirty = False
  2120.     End Sub
  2121.  
  2122.     Sub ResetNewObject(newObj As Object)
  2123.       Reset
  2124.       SelObject = newObj
  2125.     End Sub
  2126.  
  2127.   End Type
  2128.   Property SelObject Get getSelObject Set setSelObject As Object
  2129.   Property SelModule Get getSelModule As ObjectModule
  2130.   Dim viewer As Object
  2131.   Type ModuleView From ProjectAndModuleView
  2132.  
  2133.     ' METHODS for object: ObjectViewer.ModuleView
  2134.     Function FindModuleIndex(m As ObjectModule, ByVal collapse As Boolean) As Long
  2135.       Dim i, n As Integer
  2136.       n = ListCount - 1
  2137.       For i = 0 To n
  2138.         If ItemLevel(i) = kLevelModule && ItemObject(i) = m Then 
  2139.           FindModuleIndex = i
  2140.           Exit Function
  2141.         End If
  2142.       Next i
  2143.     End Function
  2144.  
  2145.     Sub MakeSelItemCurrent()
  2146.       ModuleManager.CurrentModule = SelModule
  2147.       ResetCurrentModuleIcon
  2148.     End Sub
  2149.  
  2150.     Sub Reset()
  2151.       Dim i, n, icon as Integer
  2152.       Dim m, currModule as ObjectModule
  2153.       Dim inherited Strictly As IndentedList
  2154.       Dim idx as Integer
  2155.       inherited = Me
  2156.     
  2157.       ' Clear out the list
  2158.       Clear
  2159.     
  2160.       ' Add in all the modules
  2161.       n = ModuleManager.ModuleCount - 1
  2162.       currModule = ModuleManager.CurrentModule
  2163.       For i = 0 To n
  2164.         m = ModuleManager.Module(i)
  2165.         icon = IIf(m = currModule, kIconModule + 1, kIconModule)
  2166.         idx = InsertItem(m.DisplayName, icon, 0, i)
  2167.         SetItemCanExpand(idx, 1)
  2168.         SetItemObject(idx, m)
  2169.       Next i
  2170.     
  2171.       ' Forward reset to parent and clear dirty flag
  2172.       inherited.Reset
  2173.       dirty = False
  2174.     End Sub
  2175.  
  2176.     Sub ResetCurrentModuleIcon()
  2177.       Dim i, n, currIcon as Integer
  2178.       n = ListCount - 1
  2179.       currIcon = kIconModule + 1
  2180.       For i = 0 To n
  2181.         If ItemLevel(i) = 0 Then 
  2182.           SetItemIcon(i, IIf(ItemObject(i).IsCurrent, currIcon, kIconModule))
  2183.         End If
  2184.       Next i
  2185.     End Sub
  2186.  
  2187.   End Type
  2188.   Property ActiveView Get getActiveView Set setActiveView As Object
  2189.   Type AlphaView From ObjectList
  2190.     Dim dirty As Boolean
  2191.  
  2192.     ' METHODS for object: ObjectViewer.AlphaView
  2193.     Sub Click()
  2194.       If SelObject Then ObjectEditorMgr.Selection SelObject
  2195.     End Sub
  2196.  
  2197.     Sub DblClick()
  2198.       ObjectViewer.DblClickObject SelObject
  2199.     End Sub
  2200.  
  2201.     Sub DestroySelectedObject
  2202.       DestroyObject(SelObject)
  2203.       Reset
  2204.     End Sub
  2205.  
  2206.     Sub DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  2207.       Parent.DragAndDrop(source, x, y, state, effect)
  2208.     End Sub
  2209.  
  2210.     Sub DragStart(o as XferData, x,y as single)
  2211.       o.ObjectRef = SelObject
  2212.       o.Drag(1)
  2213.       ' Drag and drop ends up eating the mouse up event.  Since we
  2214.       ' are doing left mouse dnd, this leaves the list in a state where it
  2215.       ' is expecting a mouse up.  
  2216.       ' We will explicitly send a lbutton up message to the list's hwnd
  2217.       ' to fix the problem.
  2218.       SendMessage(hWnd, User32.WM_LBUTTONUP, 0, 0)
  2219.     End Sub
  2220.  
  2221.     Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  2222.       If (keyCode = VK_F1) Then 
  2223.         ObjectViewer.Help
  2224.       ElseIf (keyCode = VK_DELETE) Then 
  2225.         EnvelopForm.DeleteObject_Click
  2226.       End If
  2227.     End Sub
  2228.  
  2229.     Sub MakeSelItemCurrent()
  2230.       If SelObject Then 
  2231.         ModuleManager.CurrentModule = ModuleManager.ModuleContaining(SelObject)
  2232.       End If
  2233.     End Sub
  2234.  
  2235.     Sub MoveSelectedObject()
  2236.       Dim o as Object
  2237.       o = SelObject
  2238.       If o Then AttachObject(o)
  2239.     End Sub
  2240.  
  2241.     Sub RenameSelectedObject(nm as String)
  2242.       Dim o as Object
  2243.       o = SelObject
  2244.       If TypeOf o Is Form Then 
  2245.         ' This will keep the Caption in sync.
  2246.         o.Name = nm
  2247.       Else 
  2248.         RenameObject(o, nm)
  2249.       End If
  2250.       Reset
  2251.       SelObject = o
  2252.     End Sub
  2253.  
  2254.     Sub Reset()
  2255.       Dim P Strictly As ObjectList
  2256.       dim oldIndex As Integer
  2257.       P = Me
  2258.     
  2259.       oldIndex = ListIndex
  2260.       ' Forward reset to our parent
  2261.       P.Reset
  2262.     
  2263.       ' If oldIndex is now too big, select last item in list
  2264.       If oldIndex >= ListCount Then oldIndex = ListCount - 1
  2265.       ListIndex = oldIndex
  2266.     
  2267.       ' Reset dirty flag
  2268.       dirty = False
  2269.     End Sub
  2270.  
  2271.     Sub ResetNewObject(newObj As Object)
  2272.       Reset
  2273.       SelObject = newObj
  2274.     End Sub
  2275.  
  2276.     Function TextUnload(ByVal indent As String, cmds As String) As Integer
  2277.       ' Write our parent's properties, but none of ours.
  2278.       TextUnload = False
  2279.     End Function
  2280.  
  2281.   End Type
  2282.   Type toolbar From ObjectBox
  2283.     Dim ViewProject As New ToolGadget
  2284.     Dim ViewModule As New ToolGadget
  2285.     Dim ViewAlphabetical As New ToolGadget
  2286.     Dim ViewHierarchical As New ToolGadget
  2287.     Dim MakeCurrent As New ToolGadget
  2288.     Dim AddModule As New ToolGadget
  2289.     Dim NewModule As New ToolGadget
  2290.     Dim LoadModule As New ToolGadget
  2291.     Dim SaveModule As New ToolGadget
  2292.     Dim UnloadModule As New ToolGadget
  2293.  
  2294.     ' METHODS for object: ObjectViewer.toolbar
  2295.     Sub DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  2296.       effect = 0
  2297.     End Sub
  2298.  
  2299.   End Type
  2300.   Type ObjectEditorHook From ObjectEditor
  2301.  
  2302.     ' METHODS for object: ObjectViewer.ObjectEditorHook
  2303.     Sub Refresh(ByVal reason As RefreshReason)
  2304.       If reason = "ModuleLoaded" || reason = "ModuleUnloaded" Then 
  2305.         ObjectViewer.Reset
  2306.       End If
  2307.     End Sub
  2308.  
  2309.   End Type
  2310.   Dim ViewProject_Enable As Integer
  2311.  
  2312.   ' METHODS for object: ObjectViewer
  2313.   Sub AddModule_Click()
  2314.     Dim p as Project
  2315.     p = ProjectManager.CurrentProject
  2316.     If p Then 
  2317.       Dim i, n as integer
  2318.       Dim m as ObjectModule
  2319.       Dim exclude as New Group
  2320.   
  2321.       ' Make a group of the modules already in the project, to be excluded.
  2322.       ' Always exclude the intrinsic module (never a project member).
  2323.       exclude.Append(ObjectModule)
  2324.       n = p.ModuleCount - 1
  2325.       For i = 0 To n
  2326.         exclude.Append(p.Module(i))
  2327.       Next i
  2328.   
  2329.       m = SelectModuleForm.ExecuteExcluding(exclude, "Select module to add")
  2330.       If m Then 
  2331.         Dim i as integer
  2332.         i = IIf(p.CurrentIndex >= 0, p.CurrentIndex + 1, -1)
  2333.         p.InsertModule(m, i)
  2334.         p.CurrentModule = m
  2335.         ResetProject(p, False)
  2336.       End If
  2337.   
  2338.     End If ' ProjectManager.CurrentProject
  2339.   End Sub
  2340.  
  2341.   Function AddModule_Enable As Integer
  2342.     Dim p As Project
  2343.     p = ProjectManager.CurrentProject
  2344.     If p Then 
  2345.       toolbar.AddModule.HintText = "Add module to project: " & p
  2346.       AddModule_Enable = True
  2347.     Else 
  2348.       toolbar.AddModule.HintText = "Add module to current project"
  2349.       AddModule_Enable = False
  2350.     End If
  2351.   End Function
  2352.  
  2353.   Function CheckAndSaveProject(p As Project) As Boolean
  2354.     ' Return FALSE only if user cancels something
  2355.     CheckAndSaveProject = True
  2356.     If ProjectIsModified(p) Then 
  2357.       Dim ync as New YesNoCancelBox
  2358.       Dim answer as Integer
  2359.       ync.title = "Close modified project"
  2360.       ync.message = "The project " & p & " is modified.^M^M"
  2361.       ync.message = ync.message & "Save project before closing?"
  2362.       answer = ync.Execute
  2363.       If answer = IDCANCEL Then 
  2364.         CheckAndSaveProject = False
  2365.       ElseIf answer = IDYES Then 
  2366.         CheckAndSaveProject = SaveProject(p)
  2367.       End If
  2368.     End If
  2369.   End Function
  2370.  
  2371.   Sub CloseProject_Click()
  2372.     Dim p as Project
  2373.     p = ProjectManager.CurrentProject
  2374.     If CheckAndSaveProject(p) Then  ' user did not cancel anything
  2375.       ProjectManager.CloseCurrentProject
  2376.       ProjectView.Reset
  2377.       If ProjectManager.ProjectCount > 0 Then 
  2378.         ActiveView = ProjectView
  2379.       Else  ' no more projects
  2380.         ActiveView = ModuleView
  2381.       End If
  2382.       DamageInactiveViews
  2383.     End If
  2384.   End Sub
  2385.  
  2386.   Function CloseProject_Enable() As Integer
  2387.     CloseProject_Enable = ProjectManager.CurrentProject <> Nothing
  2388.   End Function
  2389.  
  2390.   Function CopyObjectQuick(o As Object, ByVal quick As Boolean) As Boolean
  2391.     Dim o As Object
  2392.     o = ObjectEditorMgr.SelectedObject
  2393.     SelObject = o
  2394.     If SelObject = o Then 
  2395.       Dim uniqName As String
  2396.       uniqName = UniqueObjectName(o)
  2397.       If quick Then 
  2398.         DoCopyObject(o, uniqName)
  2399.       Else 
  2400.         If InputDialog.Execute("Copy Object", "Enter name for new copy of " & o & ":", uniqName) = IDOK Then 
  2401.           DoCopyObject(o, InputDialog.Text)
  2402.         End If
  2403.       End If
  2404.       CopyObjectQuick = True
  2405.     Else 
  2406.       CopyObjectQuick = False
  2407.     End If
  2408.   End Function
  2409.  
  2410.   Sub DamageInactiveViews
  2411.     If ActiveView <> ProjectView Then ProjectView.dirty = True
  2412.     If ActiveView <> ModuleView Then ModuleView.dirty = True
  2413.     If ActiveView <> AlphaView Then AlphaView.dirty = True
  2414.     If ActiveView <> HierView Then HierView.dirty = True
  2415.   End Sub
  2416.  
  2417.   Sub DblClickObject(o As Object)
  2418.     If o Then 
  2419.       ' Special case the EnvelopForm to turn Form-Editing off (avoids confusing state)
  2420.       If (o = EnvelopForm) Then FormEditor.Editing = False
  2421.       ObjectEditorMgr.Edit(o)
  2422.   
  2423.       ' If object is a form then bring it to top
  2424.       If TypeOf o Is Form Then o.Show : o.BringToTop
  2425.   
  2426.     End If
  2427.   End Sub
  2428.  
  2429.   Function DestroySelectedObject(o As Object) As Boolean
  2430.     SelObject = o
  2431.     If SelObject = o Then 
  2432.       ActiveView.DestroySelectedObject
  2433.       DamageInactiveViews
  2434.       ObjectEditorMgr.Selection SelObject
  2435.       DestroySelectedObject = True
  2436.     Else 
  2437.       DestroySelectedObject = False
  2438.     End If
  2439.   End Function
  2440.  
  2441.   Sub DoCopyObject(o As Object, ByVal newName As String)
  2442.     Dim sameNameObj, newObj As Object
  2443.     If IsIdentifierValid(newName) = 0 Then 
  2444.       Dim mb As New MessageBox
  2445.       mb.SetIconExclamation
  2446.       mb.Message("Invalid identifier", """" & newName & """ is not a valid object name")
  2447.       Exit Sub
  2448.     End If
  2449.   
  2450.     sameNameObj = FindObject(newName)
  2451.     If sameNameObj Then 
  2452.       If ModuleManager.ModuleContaining(sameNameObj) = ModuleManager.CurrentModule Then 
  2453.         MessageBox.Message("Object exists", """" & newName & """ already exists in the current module.")
  2454.         Exit Sub
  2455.       Else 
  2456.         If YesNoCancelBox.Message("Object exists", """" & newName & """ already exists in a different module, ^J^M^J^MOk to continue?") <> IDYES Then 
  2457.           Exit Sub
  2458.         End If
  2459.       End If
  2460.     End If
  2461.   
  2462.     newObj = CopyObject(o, newName)
  2463.     If (o && TypeOf o Is Form && StrComp(o, o.Caption) = 0) Then 
  2464.       ' Try to keep title and object name in sync, if src object was.
  2465.       newObj.Caption = newObj
  2466.     End If
  2467.   
  2468.     ActiveView.ResetNewObject(newObj)
  2469.     DamageInactiveViews
  2470.     ObjectEditorMgr.Edit newObj
  2471.   End Sub
  2472.  
  2473.   Function DoProjectSave(p As Project, ByVal saveAs As Boolean) As Boolean
  2474.     Dim resetString As Boolean
  2475.     Dim projModule As ObjectModule
  2476.   
  2477.     ' Return FALSE only if user cancels a dialog
  2478.     DoProjectSave = True
  2479.   
  2480.     ' Fix up the module list of the project, since user may have
  2481.     ' just renamed (saved-as) some module(s)
  2482.     p.SyncModulePath
  2483.     projModule = ModuleManager.ModuleContaining(p)
  2484.     projModule.Save
  2485.   
  2486.     resetString = False
  2487.     ' Write the project file and EXE, as necessary.
  2488.     If p.ProjectFileName = "" || saveAs Then 
  2489.       If SaveProjectFileAs(p) = IDCANCEL Then 
  2490.         DoProjectSave = False
  2491.         Exit Function
  2492.       End If
  2493.       resetString = True
  2494.     End If
  2495.   
  2496.     If Not p.ProjectFileMatchesMe Then p.WriteProjectFile
  2497.   
  2498.     ' If we did a save-as on the project file,
  2499.     ' then update the project view.
  2500.     If resetString Then ProjectView.ResetProjectString(p)
  2501.   
  2502.     If TypeOf p Is Application Then 
  2503.       If p.EXEFileName = "" || saveAs Then 
  2504.         If SaveProjectEXEAs(p) = IDCANCEL Then 
  2505.           DoProjectSave = False
  2506.           Exit Function
  2507.         End If
  2508.         resetString = True
  2509.       End If
  2510.       If Not p.EXEMatchesMe Then p.WriteEXE
  2511.     End If
  2512.   
  2513.     ' If we did a save-as on the project file or EXE file,
  2514.     ' then re-save the project module.
  2515.     If resetString Then projModule.Save
  2516.   
  2517.   End Function
  2518.  
  2519.   Sub DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  2520.     dim s,s2 as string
  2521.     dim p as integer
  2522.   
  2523.     If state = 4 Then 
  2524.       ' TODO: re-visit this code for ebo/eto names. Also, maybe it shouldn't be driven by
  2525.       ' name for binary modules (we could implement a test for a valid binary module).
  2526.       ' (Dez 3/12/95)
  2527.       s = source.File
  2528.       p = Instr(1, s, "ebo", 1)
  2529.       If Instr(1, s, ".ebo", 1) Then 
  2530.         ModuleManager.LoadModule(s, False)
  2531.         DamageInactiveViews
  2532.         ActiveView.Reset
  2533.       ElseIf p > 0 Then 
  2534.         s2 = Mid(s, p)
  2535.         If Instr(1, s2, ".tmp", 1) Then 
  2536.           ModuleManager.LoadModule(s, False)
  2537.           DamageInactiveViews
  2538.           ActiveView.Reset
  2539.         End If
  2540.       ElseIf Instr(1, s, ".eto", 1) Then 
  2541.         ObjectTools.LoadTextObject(s)
  2542.         DamageInactiveViews
  2543.         ActiveView.Reset
  2544.       End If
  2545.     End If
  2546.   End Sub
  2547.  
  2548.   Function getActiveView() As Object
  2549.     If Not viewer Then ActiveView = ProjectView
  2550.     getActiveView = viewer
  2551.   End Function
  2552.  
  2553.   Function getSelModule() As ObjectModule
  2554.     Dim m As ObjectModule
  2555.     Try
  2556.       dim r as long
  2557.       If PropertyExists(ActiveView, "SelModule", r) Then m = ActiveView.SelModule
  2558.     Catch
  2559.     End Try
  2560.     If Not m Then 
  2561.       ' OK, either we don't have an active view, or active view doesn't
  2562.       ' have a selected module, so take the current module as selected.
  2563.       m = ModuleManager.CurrentModule
  2564.     End If
  2565.     getSelModule = m
  2566.   End Function
  2567.  
  2568.   Function getSelObject() As Object
  2569.     getSelObject = ActiveView.SelObject
  2570.   End Function
  2571.  
  2572.   Sub Help
  2573.     If SelObject Then Envelop.Help.ShowObjectHelp(SelObject)
  2574.   End Sub
  2575.  
  2576.   Sub LoadModule(m As ObjectModule)
  2577.     If m Then 
  2578.       Dim p as Project
  2579.       p = ProjectManager.CurrentProject
  2580.       If p Then 
  2581.         Dim i as integer
  2582.         i = IIf(p.CurrentIndex >= 0, p.CurrentIndex + 1, -1)
  2583.         p.InsertModule(m, i)
  2584.         p.CurrentModule = m
  2585.         ResetProject(p, False)
  2586.       Else 
  2587.         ResetModule(m)
  2588.       End If
  2589.     End If
  2590.   End Sub
  2591.  
  2592.   Sub LoadModule_Click()
  2593.     LoadModule(Envelop.EBOOpen.BrowseForModule)
  2594.   End Sub
  2595.  
  2596.   Sub MakeCurrent_Click()
  2597.     ActiveView.MakeSelItemCurrent
  2598.     DamageInactiveViews
  2599.   End Sub
  2600.  
  2601.   Sub MoveObject_Click()
  2602.     Dim o As Object
  2603.     o = ObjectEditorMgr.SelectedObject
  2604.     SelObject = o
  2605.     If (SelObject <> o) Then 
  2606.       InfoBox.Message("Move Failed", "Unable to move object: " & o)
  2607.       Exit Sub
  2608.     End If
  2609.     ActiveView.MoveSelectedObject
  2610.     DamageInactiveViews
  2611.   End Sub
  2612.  
  2613.   Function MoveObject_Enable() As Integer
  2614.     Dim o As Object
  2615.     o = ObjectEditorMgr.SelectedObject
  2616.     MoveObject_Enable = (o && ModuleManager.ModuleContaining(o) <> ModuleManager.CurrentModule)
  2617.   End Function
  2618.  
  2619.   Sub NewModule_Click()
  2620.     LoadModule(ModuleManager.LoadModule("", False))
  2621.   End Sub
  2622.  
  2623.   Sub NewObject_Click()
  2624.     If InputDialog.Execute("New Object", "Enter name for new object:", "") = IDOK Then 
  2625.       DoCopyObject(Nothing, InputDialog.Text)
  2626.     End If
  2627.   End Sub
  2628.  
  2629.   Sub NewProject_Click()
  2630.     Dim p As Project
  2631.     p = NewProjectForm.Execute
  2632.     If p Then ResetProject(p, True)
  2633.   End Sub
  2634.  
  2635.   Sub OpenProject_Click()
  2636.     Dim dlg As New OpenDialog
  2637.   
  2638.     dlg.FileName = "*.epj"
  2639.     dlg.InitialDir = Envelop.FileDialogDir
  2640.     dlg.Title = "Open Project"
  2641.     dlg.Filter = "Envelop projects (*.epj)|*.epj|All files (*.*)|*.*|"
  2642.     dlg.DefaultExtension = "epj"
  2643.     dlg.FilterIndex = 1
  2644.     dlg.FileMustExist = True
  2645.     dlg.PathMustExist = True
  2646.     dlg.NoChangeDir = True
  2647.     If dlg.Execute = IDOK Then 
  2648.       Dim p as Project
  2649.       Envelop.FileDialogDir = dlg.FileName
  2650.       p = ProjectManager.OpenProject(dlg.FileName)
  2651.       ProjectView.Reset
  2652.       ActiveView = ProjectView
  2653.       DamageInactiveViews
  2654.       ProjectView.SelProject = p
  2655.       ProjectView.ExpandItem(ProjectView.ListIndex)
  2656.       If p && TypeOf p Is Application && p.MainForm Then 
  2657.         p.MainForm.Show
  2658.       End If
  2659.     End If
  2660.   End Sub
  2661.  
  2662.   Function ProjectIsModified(p As Project) As Boolean
  2663.   
  2664.     If Not p Then 
  2665.       ProjectIsModified = False
  2666.     Else 
  2667.   
  2668.       Dim i, n as integer
  2669.       Dim m as ObjectModule
  2670.   
  2671.       ' Check each module in the project; any modified and we can return.
  2672.       n = p.ModuleCount - 1
  2673.       For i = 0 To n
  2674.         m = p.Module(i)
  2675.         If m && (Not m.ReadOnly) && m.IsModified Then 
  2676.           ProjectIsModified = True
  2677.           Exit Function
  2678.         End If
  2679.       Next i
  2680.   
  2681.       ' Check the project file and EXE, as necessary.
  2682.       If Not p.ProjectFileMatchesMe Then 
  2683.         ProjectIsModified = True
  2684.         Exit Function
  2685.       End If
  2686.   
  2687.       If TypeOf p Is Application Then 
  2688.         If Not p.EXEMatchesMe Then 
  2689.           ProjectIsModified = True
  2690.           Exit Function
  2691.         End If
  2692.       End If
  2693.   
  2694.     End If ' Not p
  2695.   
  2696.   End Function
  2697.  
  2698.   Function ProjectNeedsSaved(p As Project) As Boolean
  2699.     ' Check the project file and EXE, as necessary.
  2700.     If p.ProjectFileName = "" || Not p.ProjectFileMatchesMe Then 
  2701.       ProjectNeedsSaved = True
  2702.       Exit Function
  2703.     End If
  2704.   
  2705.     If TypeOf p Is Application Then 
  2706.       If p.EXEFileName = "" || Not p.EXEMatchesMe Then 
  2707.         ProjectNeedsSaved = True
  2708.         Exit Function
  2709.       End If
  2710.     End If
  2711.   End Function
  2712.  
  2713.   Function ProjFileMatchesEXE(p As Project) As Boolean
  2714.     If TypeOf p Is Application Then 
  2715.       Dim pf, xf As New File
  2716.       pf.FileName = p.ProjectFileName
  2717.       xf.FileName = p.EXEFileName
  2718.       ProjFileMatchesEXE = (pf.Name <> "") && (pf.Name = xf.Name)
  2719.     Else 
  2720.       ProjFileMatchesEXE = False
  2721.     End If
  2722.   End Function
  2723.  
  2724.   Function RenameSelectedObject(o As Object, newName As String)
  2725.     SelObject = o
  2726.     If SelObject = o Then 
  2727.       Dim resetACL As Long
  2728.       resetACL = 0
  2729.   
  2730.       ' If object is a project object, then try to change permissions
  2731.       ' to allow rename to go through.
  2732.       If TypeOf o Is Project Then 
  2733.         Try
  2734.           resetACL = o.AccessControl.ObjectAccess
  2735.           o.AccessControl.ObjectAccess = "126 - R,W,C,D,M,P"
  2736.         Catch
  2737.         End Try
  2738.       End If
  2739.       Try
  2740.         ActiveView.RenameSelectedObject(newName)
  2741.         DamageInactiveViews
  2742.       Catch
  2743.         If resetACL Then o.AccessControl.ObjectAccess = resetACL
  2744.         Throw
  2745.       End Try
  2746.       If resetACL Then o.AccessControl.ObjectAccess = resetACL
  2747.       RenameSelectedObject = True
  2748.     Else 
  2749.       RenameSelectedObject = False
  2750.     End If
  2751.   End Function
  2752.  
  2753.   Sub Reset()
  2754.     ProjectView.dirty = True
  2755.     ModuleView.dirty = True
  2756.     AlphaView.dirty = True
  2757.     HierView.dirty = True
  2758.     ActiveView.Reset
  2759.   End Sub
  2760.  
  2761.   Sub ResetAbstract(abso As Object)
  2762.     ActiveView.Reset
  2763.     SelObject = abso
  2764.     If ActiveView = HierView Then HierView.ExpandItem(HierView.ListIndex)
  2765.   End Sub
  2766.  
  2767.   Sub ResetModule(m As ObjectModule)
  2768.     ModuleView.Reset
  2769.     ActiveView = ModuleView
  2770.     DamageInactiveViews
  2771.     ModuleView.SelModule = m
  2772.   End Sub
  2773.  
  2774.   Sub ResetModuleString(m as ObjectModule)
  2775.     ProjectView.ResetModuleString(m)
  2776.     ModuleView.ResetModuleString(m)
  2777.   End Sub
  2778.  
  2779.   Sub ResetNewObject(newObj As Object)
  2780.     ActiveView.ResetNewObject(newObj)
  2781.     DamageInactiveViews
  2782.   End Sub
  2783.  
  2784.   Sub ResetProject(p As Project, expandCurrMod As Boolean)
  2785.     ProjectView.ResetProject(p, expandCurrMod)
  2786.     ActiveView = ProjectView
  2787.     DamageInactiveViews
  2788.   End Sub
  2789.  
  2790.   Sub Resize()
  2791.     Dim l, t, w, h as Single
  2792.     l = -30
  2793.     w = ScaleWidth - l
  2794.     toolbar.Move(l, l, w, toolbar.Height)
  2795.     t = toolbar.Top + toolbar.Height
  2796.     h = ScaleHeight - toolbar.Height + 45
  2797.   
  2798.     ProjectView.Move(l, t, w, h)
  2799.     AlphaView.Move(l, t, w, h)
  2800.     HierView.Move(l, t, w, h)
  2801.     ModuleView.Move(l, t, w, h)
  2802.   End Sub
  2803.  
  2804.   Sub SaveAll_Click()
  2805.     Dim m as ObjectModule
  2806.     Dim p as Project
  2807.     Dim i, n as integer
  2808.   
  2809.     ' Display busy-signal immediately.
  2810.     App.ShowBusySignal
  2811.   
  2812.     ' First, save all modules.
  2813.     ' The 0th module is always the intrinsic module, so skip it.
  2814.     n = ModuleManager.ModuleCount - 1
  2815.     For i = 1 To n
  2816.       m = ModuleManager.Module(i)
  2817.       If Not m.ReadOnly && m.IsModified Then 
  2818.         If Not Envelop.SADlg.SaveModule(m) Then  ' user canceled
  2819.           Exit Sub
  2820.         End If
  2821.       End If
  2822.     Next i
  2823.   
  2824.     ' Now, for each open project, make sure it is properly saved, too.
  2825.     n = ProjectManager.ProjectCount - 1
  2826.     For i = 0 To n
  2827.       If Not DoProjectSave(ProjectManager.Project(i), False) Then  ' user canceled
  2828.         Exit Sub
  2829.       End If
  2830.     Next i
  2831.   End Sub
  2832.  
  2833.   Function SaveAll_Enable() As Integer
  2834.     Dim m as ObjectModule
  2835.     Dim i, n as integer
  2836.     n = ModuleManager.ModuleCount - 1
  2837.     For i = 1 To n
  2838.       m = ModuleManager.Module(i)
  2839.       If m.ReadOnly = False && m.IsModified Then 
  2840.         SaveAll_Enable = True
  2841.         Exit Function
  2842.       End If
  2843.     Next i
  2844.   
  2845.     n = ProjectManager.ProjectCount - 1
  2846.     For i = 0 To n
  2847.       If ProjectNeedsSaved(ProjectManager.Project(i)) Then 
  2848.         SaveAll_Enable = True
  2849.         Exit Function
  2850.       End If
  2851.     Next i
  2852.   
  2853.     SaveAll_Enable = False
  2854.   End Function
  2855.  
  2856.   Sub SaveModuleAs_Click
  2857.     Dim m As ObjectModule
  2858.     m = SelModule
  2859.     If m <> ObjectModule && Envelop.SADlg.SaveAs(m) Then 
  2860.       ModuleView.ResetModuleString m
  2861.       ProjectView.ResetModuleString m
  2862.     End If
  2863.   End Sub
  2864.  
  2865.   Function SaveModuleAs_Enable() As Integer
  2866.     SaveModuleAs_Enable = SelModule <> ObjectModule
  2867.   End Function
  2868.  
  2869.   Sub SaveModule_Click()
  2870.     Dim m As ObjectModule
  2871.     m = SelModule
  2872.     If Envelop.SADlg.SaveModule(m) Then 
  2873.       ModuleView.ResetModuleString m
  2874.       ProjectView.ResetModuleString m
  2875.     End If
  2876.   End Sub
  2877.  
  2878.   Function SaveModule_Enable() As Integer
  2879.     Dim m as ObjectModule
  2880.     Dim enable as Integer
  2881.     m = SelModule
  2882.     enable = (Not m.ReadOnly && m.IsModified)
  2883.     If enable Then 
  2884.       toolbar.SaveModule.HintText = "Save module: " & m.DisplayName
  2885.     Else 
  2886.       toolbar.SaveModule.HintText = "Save module"
  2887.     End If
  2888.     SaveModule_Enable = enable
  2889.   End Function
  2890.  
  2891.   Function SaveProject(p As Project) As Boolean
  2892.     ' Return FALSE only if user cancels any dialog
  2893.     SaveProject = True
  2894.     If p Then 
  2895.       Dim i, n As Integer
  2896.       Dim m As ObjectModule
  2897.   
  2898.       ' Save each module in the project
  2899.       n = p.ModuleCount - 1
  2900.       For i = 0 To n
  2901.         m = p.Module(i)
  2902.         If m && (Not m.ReadOnly) && m.IsModified Then 
  2903.           If Envelop.SADlg.SaveModule(m) = False Then 
  2904.             SaveProject = False
  2905.             Exit Function
  2906.           End If
  2907.         End If
  2908.       Next i
  2909.   
  2910.       ' Save the project files
  2911.       SaveProject = DoProjectSave(p, False)
  2912.   
  2913.     End If
  2914.   End Function
  2915.  
  2916.   Sub SaveProjectAs_Click()
  2917.     Dim p as Project
  2918.     p = ProjectManager.CurrentProject
  2919.     If p Then 
  2920.       Dim i, n As Integer
  2921.       Dim m As ObjectModule
  2922.   
  2923.       ' Ensure each module in the project is titled
  2924.       n = p.ModuleCount - 1
  2925.       For i = 0 To n
  2926.         m = p.Module(i)
  2927.         If m && m.IsUntitled Then 
  2928.           If Envelop.SADlg.SaveModule(m) = False Then  ' user canceled
  2929.             Exit Sub
  2930.           End If
  2931.         End If
  2932.       Next i
  2933.   
  2934.       DoProjectSave(p, True)
  2935.   
  2936.     End If ' ProjectManager.CurrentProject
  2937.   End Sub
  2938.  
  2939.   Function SaveProjectAs_Enable() As Integer
  2940.     SaveProjectAs_Enable = ProjectManager.CurrentProject <> Nothing
  2941.   End Function
  2942.  
  2943.   Function SaveProjectEXEAs(p as Project) As Integer
  2944.     Dim dlg As New SaveAsDialog
  2945.     Dim file As New File
  2946.     Dim name As String
  2947.   
  2948.     name = p.ProjectFileName
  2949.     If p.EXEFileName = "" && name <> "" Then 
  2950.       ' Sync the project file name and EXE file name.
  2951.       file.FileName = name
  2952.       name = file.Path & file.Name & ".exe"
  2953.     Else 
  2954.       name = p.EXEFileName
  2955.     End If
  2956.   
  2957.     If name <> "" Then 
  2958.       file.FileName = name
  2959.       dlg.FileName = file.Name & file.Extension
  2960.       dlg.InitialDir = file.Path
  2961.     Else 
  2962.       dlg.FileName = "*.exe"
  2963.       dlg.InitialDir = Envelop.FileDialogDir
  2964.     End If
  2965.   
  2966.     dlg.Title = "Save application EXE file as"
  2967.     dlg.Filter = "Executable files (*.exe)|*.exe|All files (*.*)|*.*|"
  2968.     dlg.DefaultExtension = "exe"
  2969.     dlg.FilterIndex = 1
  2970.     dlg.PathMustExist = True
  2971.     dlg.NoChangeDir = True
  2972.     SaveProjectEXEAs = IDCANCEL
  2973.     If dlg.Execute = IDOK Then 
  2974.       p.EXEFileName = dlg.FileName
  2975.       p.WriteEXE
  2976.       SaveProjectEXEAs = IDOK
  2977.       Envelop.FileDialogDir = dlg.FileName
  2978.     End If
  2979.   End Function
  2980.  
  2981.   Function SaveProjectFileAs(p as Project) As Integer
  2982.     Dim dlg As New SaveAsDialog
  2983.     Dim name As String
  2984.     name = p.ProjectFileName
  2985.     If name <> "" Then 
  2986.       Dim file As New File
  2987.       file.FileName = name
  2988.       dlg.FileName = file.Name & file.Extension
  2989.       dlg.InitialDir = IIf(Instr(name, ".") > 0, file.Path, Envelop.FlieDialogDir)
  2990.     Else 
  2991.       dlg.FileName = "*.epj"
  2992.       dlg.InitialDir = Envelop.FileDialogDir
  2993.     End If
  2994.     dlg.Title = "Save project file as"
  2995.     dlg.Filter = "Envelop projects (*.epj)|*.epj|All files (*.*)|*.*|"
  2996.     dlg.DefaultExtension = "epj"
  2997.     dlg.FilterIndex = 1
  2998.     dlg.PathMustExist = True
  2999.     dlg.NoChangeDir = True
  3000.     SaveProjectFileAs = IDCANCEL
  3001.     If dlg.Execute = IDOK Then 
  3002.       ' If project is an application, and the EXE name matches the project
  3003.       ' file name, then keep the EXE name in sync here.
  3004.       Dim syncEXE as Boolean
  3005.       syncEXE = ProjFileMatchesEXE(p)
  3006.       p.ProjectFileName = dlg.FileName
  3007.       p.WriteProjectFile
  3008.       If syncEXE Then 
  3009.         Dim pf, xf As New File
  3010.         pf.FileName = p.ProjectFileName
  3011.         xf.FileName = p.EXEFileName
  3012.         p.EXEFileName = IIf(xf.Path = "", pf.Path, xf.Path) & pf.Name & ".exe"
  3013.       End If
  3014.       Envelop.FileDialogDir = dlg.FileName
  3015.       SaveProjectFileAs = IDOK
  3016.     End If
  3017.   End Function
  3018.  
  3019.   Sub SaveProject_Click()
  3020.     SaveProject ProjectManager.CurrentProject
  3021.   End Sub
  3022.  
  3023.   Function SaveProject_Enable
  3024.     Dim p as Project
  3025.     p = ProjectManager.CurrentProject
  3026.     If p Then 
  3027.       Dim i, n as integer
  3028.       Dim m as ObjectModule
  3029.   
  3030.       ' Check each module in the project, bail if any modified
  3031.       n = p.ModuleCount - 1
  3032.       For i = 0 To n
  3033.         m = p.Module(i)
  3034.         If m && (Not m.ReadOnly) && m.IsModified Then 
  3035.           SaveProject_Enable = True
  3036.           Exit Function
  3037.         End If
  3038.       Next i
  3039.   
  3040.       SaveProject_Enable = ProjectNeedsSaved(p)
  3041.   
  3042.     End If ' ProjectManager.CurrentProject
  3043.   
  3044.     SaveProject_Enable = False
  3045.   End Function
  3046.  
  3047.   Sub setActiveView(o as Object)
  3048.     Dim selobj as Object
  3049.   
  3050.     If o = viewer Or Not o Then Exit Sub
  3051.   
  3052.     If viewer Then 
  3053.       selobj = viewer.SelObject
  3054.       viewer.Visible = False
  3055.     End If
  3056.     viewer = o
  3057.     If viewer.dirty Then viewer.Reset
  3058.     If o <> ProjectView Then viewer.SelObject = selobj
  3059.     viewer.Visible = True
  3060.     viewer.SetFocus
  3061.   
  3062.     SyncViewerGadget
  3063.   End Sub
  3064.  
  3065.   Sub setSelObject(o as Object)
  3066.     ActiveView.SelObject = o
  3067.   End Sub
  3068.  
  3069.   Sub Startup
  3070.     Dim p as Project
  3071.     With ProjectStartupOptions
  3072.       Select Case .StartupAction
  3073.         Case .ACTION_NO_PROJECT
  3074.           toolbar.ViewModule.State = 1
  3075.           ActiveView = ModuleView
  3076.         Case .ACTION_OPEN_PROJECT
  3077.           OpenProject_Click
  3078.           ActiveView = ProjectView
  3079.         Case .ACTION_NEW_PROJECT
  3080.           NewProject_Click
  3081.           ActiveView = ProjectView
  3082.         Case Else ' Includes .ACTION_DEFAULT_PROJECT
  3083.           p = NewProjectForm.MakeDefaultProject
  3084.           ActiveView = ProjectView
  3085.           ResetProject(p, True)
  3086.           ViewProject_Enable = -1
  3087.       End Select
  3088.       Show
  3089.       ActiveView.Reset
  3090.     End With
  3091.   End Sub
  3092.  
  3093.   Sub SyncViewerGadget
  3094.     Select Case viewer
  3095.       Case ProjectView
  3096.         toolbar.ViewProject.State = "Down"
  3097.       Case ModuleView
  3098.         toolbar.ViewModule.State = "Down"
  3099.       Case AlphaView
  3100.         toolbar.ViewAlphabetical.State = "Down"
  3101.       Case HierView
  3102.         toolbar.ViewHierarchical.State = "Down"
  3103.     End Select
  3104.   End Sub
  3105.  
  3106.   Function TextUnload(ByVal indent As String, cmds As String) As Integer
  3107.     ' Set to ProjectView before saving text
  3108.     ViewProject_Click
  3109.   
  3110.     ' Write our parent's properties, but none of ours.
  3111.     TextUnload = False
  3112.   End Function
  3113.  
  3114.   Sub UnloadModule_Click()
  3115.     Dim p As Project
  3116.     Dim m As ObjectModule
  3117.     Dim ync As New YesNoCancelBox
  3118.     Dim r As Integer
  3119.   
  3120.     ' Try first to remove the selected module from current project
  3121.     ' or first project that contains it.
  3122.     ' If no projects have the selected module, just unload it.
  3123.     m = SelModule
  3124.     p = ProjectManager.CurrentProject
  3125.     If p = Nothing || p.ModuleIndex(m) = -1 Then 
  3126.       p = ProjectManager.FirstProjectContainingModule(m)
  3127.     End If
  3128.     If p Then 
  3129.       ' Can't remove the module containing the project object
  3130.       If m = ModuleManager.ModuleContaining(p) Then 
  3131.         Dim mb As New MessageBox
  3132.         mb.title = "Unload module error"
  3133.         mb.message = "Module: " & m.DisplayName & " contains project: " & p & "^M^M"
  3134.         mb.message = mb.message & "Can't unload module that contains the project object"
  3135.         mb.Execute
  3136.         Exit Sub
  3137.       End If
  3138.   
  3139.       If (Not m.ReadOnly) && m.IsModified Then 
  3140.         ync.title = "Unload modified module"
  3141.         ync.message = "Module: " & m.DisplayName & " is modified.^M^MSave before unloading from project: " & p & "?"
  3142.         r = ync.Execute
  3143.         If r = IDCANCEL Then Exit Sub
  3144.         If r = IDYES Then 
  3145.           If Not Envelop.SADlg.SaveModule(m) Then  ' user canceled the save
  3146.             Exit Sub
  3147.           End If
  3148.         End If
  3149.       Else 
  3150.         Dim yn As New YesNoBox
  3151.         yn.title = "Unload module"
  3152.         yn.message = "Unload module: " & m.DisplayName & " from project: " & p & "?"
  3153.         If yn.Execute = IDNO Then Exit Sub
  3154.       End If
  3155.   
  3156.       ' Ignore unload failed exceptions.
  3157.       Try
  3158.         p.RemoveModule(m)
  3159.       Catch ModuleUnloadFailed
  3160.       End Try
  3161.       ResetProject(p, False)
  3162.     ElseIf m.CanUnload Then  ' no project w/ module, just unload.
  3163.       If (Not m.ReadOnly) && m.IsModified Then 
  3164.         ync.title = "Unload modified module"
  3165.         ync.message = "Module: " & m.DisplayName & " is modified.^M^MSave before unloading?"
  3166.         r = ync.Execute
  3167.         If r = IDCANCEL Then Exit Sub
  3168.         If r = IDYES Then 
  3169.           If Not Envelop.SADlg.SaveModule(m) Then  ' user canceled the save
  3170.             Exit Sub
  3171.           End If
  3172.         End If
  3173.       End If
  3174.       m.Unload
  3175.     End If
  3176.   End Sub
  3177.  
  3178.   Function UnloadModule_Enable As Integer
  3179.     Dim p As Project
  3180.     Dim m As ObjectModule
  3181.     m = SelModule
  3182.     p = ProjectManager.CurrentProject
  3183.     If p = Nothing || p.ModuleIndex(m) = -1 Then 
  3184.       p = ProjectManager.FirstProjectContainingModule(m)
  3185.     End If
  3186.   
  3187.     ' Can't remove the module containing the project object
  3188.     If p Then 
  3189.       If m = ModuleManager.ModuleContaining(p) Then 
  3190.         toolbar.UnloadModule.HintText = "Unload module"
  3191.         UnloadModule_Enable = False
  3192.       Else 
  3193.         toolbar.UnloadModule.HintText = "Unload module: " & m.DisplayName & " from project: " & p
  3194.         UnloadModule_Enable = True
  3195.       End If
  3196.     Else 
  3197.       If m.CanUnload Then 
  3198.         toolbar.UnloadModule.HintText = "Unload module: " & m.DisplayName
  3199.         UnloadModule_Enable = True
  3200.       Else 
  3201.         toolbar.UnloadModule.HintText = "Unload module"
  3202.         UnloadModule_Enable = False
  3203.       End If
  3204.     End If
  3205.   End Function
  3206.  
  3207.   Sub ViewAlphabetical_Click
  3208.     If ActiveView = AlphaView Then 
  3209.       AlphaView.Reset
  3210.     Else 
  3211.       ActiveView = AlphaView
  3212.     End If
  3213.   End Sub
  3214.  
  3215.   Sub ViewHierarchical_Click
  3216.     If ActiveView = HierView Then 
  3217.       HierView.Reset
  3218.     Else 
  3219.       ActiveView = HierView
  3220.     End If
  3221.   End Sub
  3222.  
  3223.   Sub ViewModule_Click
  3224.     If ActiveView = ModuleView Then 
  3225.       ModuleView.Reset
  3226.     Else 
  3227.       ActiveView = ModuleView
  3228.     End If
  3229.   End Sub
  3230.  
  3231.   Sub ViewProject_Click
  3232.     If ActiveView = ProjectView Then 
  3233.       ProjectView.Reset
  3234.     Else 
  3235.       ActiveView = ProjectView
  3236.     End If
  3237.   End Sub
  3238.  
  3239. End Type
  3240.  
  3241. Type SourceSearcher From Form
  3242.   Dim Search As New Button
  3243.   Dim ModuleCombo As New ComboBox
  3244.   Dim Label3 As New Label
  3245.   Dim SearchCombo As New ComboBox
  3246.   Dim MaxEntries As Integer
  3247.   Dim HitResults As New IndentedList
  3248.   Dim bitmap As New Bitmap
  3249.   Dim SearchModule As ObjectModule
  3250.   Dim ObjectsBtn As New Button
  3251.   Dim HitFilter As New CheckBox
  3252.   Dim AutoExpand As New CheckBox
  3253.   Dim Help As New Button
  3254.   Dim searchGroup As New Group
  3255.   Type ListObject
  3256.     Dim obj As Object
  3257.  
  3258.     ' METHODS for object: SourceSearcher.ListObject
  3259.     Function Create(o As Object) As SourceSearcher.ListObject
  3260.       dim newobj as New SourceSearcher.ListObject
  3261.       newobj.obj = o
  3262.       Create = newobj
  3263.     End Function
  3264.  
  3265.     Sub Expand(list As IndentedList, itemIndex As Integer)
  3266.       dim resetCurObject As New SourceSearcher.ResetCurObject
  3267.     
  3268.       ' Item is an object
  3269.       SourceIterator.CurObject = obj
  3270.       SourceIterator.CurMethod = ""
  3271.       While SourceIterator.NextMethod()
  3272.         ' Only add methods for which there is a hit.
  3273.         If (SourceIterator.NextHit()) Then 
  3274.           dim curIndex as integer
  3275.           curIndex = list.InsertItem(SourceIterator.CurMethod, 1, 1, itemIndex + 1)
  3276.           list.SetItemCanExpand(curIndex, 1)
  3277.           list.SetItemObject(curIndex, SourceSearcher.ListMethod.Create(obj, SourceIterator.CurMethod))
  3278.         End If
  3279.       Wend
  3280.     End Sub
  3281.  
  3282.   End Type
  3283.   Type ListMethod From SourceSearcher.ListObject
  3284.     Dim meth As String
  3285.  
  3286.     ' METHODS for object: SourceSearcher.ListMethod
  3287.     Function Create(o As Object, m As String) As SourceSearcher.ListMethod
  3288.       dim newobj as New SourceSearcher.ListMethod
  3289.       newobj.obj = o
  3290.       newobj.meth = m
  3291.       Create = newobj
  3292.     End Function
  3293.  
  3294.     Sub Expand(list As IndentedList, itemIndex As Integer)
  3295.       dim curIndex as integer
  3296.       dim resetCurObject As New SourceSearcher.ResetCurObject
  3297.     
  3298.       curIndex = itemIndex
  3299.     
  3300.       SourceIterator.CurObject = obj
  3301.       SourceIterator.CurMethod = meth
  3302.       While SourceIterator.NextHit()
  3303.         curIndex = list.InsertItem(SourceIterator.HitLine & ": " & SourceIterator.HitLineText, 2, 2, curIndex + 1)
  3304.         list.SetItemObject(curIndex, SourceSearcher.ListHit.Create(obj, meth, SourceIterator.HitStart, SourceIterator.HitLength))
  3305.         SourceIterator.HitStart = SourceIterator.HitStart + 1
  3306.       Wend
  3307.     End Sub
  3308.  
  3309.   End Type
  3310.   Type ListHit From SourceSearcher.ListMethod
  3311.     Dim hitStart As Integer
  3312.     Dim hitLength As Integer
  3313.  
  3314.     ' METHODS for object: SourceSearcher.ListHit
  3315.     Function Create(o As Object, m As String, ByVal hs, ByVal hl as integer) As SourceSearcher.ListHit
  3316.       dim newobj as New SourceSearcher.ListHit
  3317.       newobj.obj = o
  3318.       newobj.meth = m
  3319.       newobj.hitStart = hs
  3320.       newobj.hitLength = hl
  3321.       Create = newobj
  3322.     End Function
  3323.  
  3324.     Sub Expand(list As IndentedList, itemIndex As Integer)
  3325.       Throw InvalidExpand()
  3326.     End Sub
  3327.  
  3328.   End Type
  3329.   Type ResetCurObject
  3330.  
  3331.     ' METHODS for object: SourceSearcher.ResetCurObject
  3332.     Sub Destruct()
  3333.       SourceIterator.CurObject = Nothing
  3334.     End Sub
  3335.  
  3336.   End Type
  3337.  
  3338.   ' METHODS for object: SourceSearcher
  3339.   Sub addObjects()
  3340.     dim o as object
  3341.     dim i as integer
  3342.     For i = 0 To searchGroup.Count - 1
  3343.       dim curIndex as integer
  3344.       o = searchGroup(i)
  3345.       curIndex = HitResults.AddItem(o, 0)
  3346.       HitResults.SetItemCanExpand(curIndex, 1)
  3347.       HitResults.SetItemObject(curIndex, SourceSearcher.ListObject.Create(o))
  3348.     Next i
  3349.   End Sub
  3350.  
  3351.   Sub Help_Click()
  3352.     dim oldtrap as integer
  3353.     oldtrap = Debugger.TrapSystemExceptions
  3354.     Debugger.TrapSystemExceptions = 0
  3355.     Try
  3356.       dim helptext as string
  3357.       helptext = "^J1. Select a module (or all modules) to pick objects to search.^J"
  3358.       helptext = helptext & "2. Type a search string (regular expression).^J"
  3359.       helptext = helptext & "3. Click SEARCH button.^J"
  3360.   
  3361.       helptext = helptext & "^JUsing list:^J . Expand an object to show methods where search pattern is found.^J"
  3362.       helptext = helptext & " . Expand a method to show lines of source that match pattern.^J"
  3363.       helptext = helptext & " . Select a hit to view method source."
  3364.   
  3365.       helptext = helptext & "^J^JOptions:^J[ ] Only show hits - use this option to make search results only show hit strings.^J"
  3366.       helptext = helptext & "[ ] Auto expand - Use this option to force full expansion of search results.^J"
  3367.       helptext = helptext & "^JOBJECTS button - Seed list with objects from current module selection."
  3368.   
  3369.   
  3370.       InfoBox.Message("Using the Source Searcher", helptext)
  3371.     catch NotFound()
  3372.     End Try
  3373.     Debugger.TrapSystemExceptions = oldtrap
  3374.   End Sub
  3375.  
  3376.   Sub HitFilter_Click()
  3377.     If HitFilter.Value Then 
  3378.       AutoExpand.Value = 1
  3379.       AutoExpand.Enabled = False
  3380.     Else 
  3381.       AutoExpand.Enabled = True
  3382.     End If
  3383.   End Sub
  3384.  
  3385.   Sub HitResults_Click()
  3386.     dim o as Object
  3387.     o = HitResults.ItemObject(HitResults.ListIndex)
  3388.   
  3389.     ' If the object referred to by this item is now gone, remove the item
  3390.     If (Not o.obj) Then HitResults.RemoveItem(HitResults.ListIndex)
  3391.   
  3392.     If (TypeOf o Is SourceSearcher.ListHit) Then 
  3393.       If (MethodExists(o.obj, o.meth)) Then 
  3394.         MethodEditor.ChangeState(o.obj, o.meth)
  3395.         MethodEditor.SelStart = o.hitStart
  3396.         MethodEditor.SelLength = o.hitLength
  3397.         MethodEditor.SetFocus
  3398.       End If
  3399.     End If
  3400.   End Sub
  3401.  
  3402.   Sub HitResults_DblClick()
  3403.     dim o as Object
  3404.     o = HitResults.ItemObject(HitResults.ListIndex)
  3405.   
  3406.     ' If the object referred to by this item is now gone, remove the item
  3407.     If (Not o.obj) Then HitResults.RemoveItem(HitResults.ListIndex)
  3408.   
  3409.     If (TypeOf o Is SourceSearcher.ListObject) Then 
  3410.       ObjectEditorMgr.Edit o.obj
  3411.     End If
  3412.   End Sub
  3413.  
  3414.   Sub HitResults_Expand(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj As Object)
  3415.     SourceIterator.SearchPattern = SearchCombo.Text
  3416.     itemObj.Expand(HitResults, itemIndex)
  3417.   End Sub
  3418.  
  3419.   Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  3420.     If (keyCode = VK_F1) Then Envelop.Help.ShowTopicHelp("Source_Searcher")
  3421.   End Sub
  3422.  
  3423.   Sub Load()
  3424.     HitResults.IconBitmap = bitmap
  3425.   
  3426.     AutoExpand.Enabled = True
  3427.     AutoExpand.Value = "Checked"
  3428.   
  3429.     MakeModuleList()
  3430.     ModuleCombo.ListIndex = 1
  3431.   End Sub
  3432.  
  3433.   Sub MakeModuleList()
  3434.     dim i as integer
  3435.   
  3436.     ModuleCombo.Clear
  3437.     ModuleCombo.AddItem("All")
  3438.     ModuleCombo.AddItem("Open Module")
  3439.   
  3440.     For i = 0 To ModuleManager.ModuleCount - 1
  3441.       dim om as ObjectModule
  3442.       dim modname as string
  3443.       om = ModuleManager.Module(i)
  3444.       modname = "#" & i & " : " & IIf(om.FileName <> "", om.FileName, "<Detached>") & " (" & om.StaticCount & ")"
  3445.       ModuleCombo.AddItem(modname)
  3446.     Next i
  3447.   End Sub
  3448.  
  3449.   Sub ModuleCombo_Click()
  3450.   
  3451.     If (ModuleCombo.ListIndex = 0) Then 
  3452.       SearchModule = Nothing
  3453.     ElseIf (ModuleCombo.ListIndex = 1) Then 
  3454.       SearchModule = ModuleManager.CurrentModule
  3455.     Else 
  3456.       dim modnum as integer
  3457.       dim itemname as string
  3458.   
  3459.       itemname = ModuleCombo.List(ModuleCombo.ListIndex)
  3460.       modnum = Mid(itemname, 2, Instr(itemname, " ") - 2)
  3461.   
  3462.       SearchModule = ModuleManager.Module(modnum)
  3463.     End If
  3464.   
  3465.     HitResults.Clear()
  3466.   End Sub
  3467.  
  3468.   Sub ModuleCombo_DropDown()
  3469.     dim listIndex As Integer
  3470.   
  3471.     ' Remember the original selection before remaking list.
  3472.     listIndex = ModuleCombo.ListIndex
  3473.     MakeModuleList
  3474.   
  3475.     ' After list is remade, reset selection if it is no longer valid.
  3476.     If (listIndex >= ModuleCombo.ListCount) Then listIndex = 1
  3477.   
  3478.     ' Pick a module, tries to maintain original selection
  3479.     ModuleCombo.ListIndex = listIndex
  3480.   End Sub
  3481.  
  3482.   Sub ObjectsBtn_Click()
  3483.   
  3484.     ' Show the busy cursor, to indicate we are working.
  3485.     If App Then App.ShowBusySignal
  3486.   
  3487.     searchGroup.Clear()
  3488.     HitResults.Clear()
  3489.     If (SearchModule) Then 
  3490.       SearchModule.GetPrototypeObjects(searchGroup)
  3491.     Else 
  3492.       dim i as integer
  3493.   
  3494.       For i = 0 To ModuleManager.ModuleCount - 1
  3495.         dim om as ObjectModule
  3496.         om = ModuleManager.Module(i)
  3497.         om.GetPrototypeObjects(searchGroup)
  3498.       Next i
  3499.     End If
  3500.   
  3501.     addObjects()
  3502.   End Sub
  3503.  
  3504.   Sub Resize()
  3505.     HitResults.Width = ScaleWidth - (HitResults.Left * 2)
  3506.     HitResults.Height = ScaleHeight - (HitResults.Top + 45)
  3507.   End Sub
  3508.  
  3509.   Sub SearchCombo_KeyDown(keyCode As Integer, ByVal shift As Integer)
  3510.     If keyCode = VK_RETURN Then 
  3511.       SendEvent Search.Click()
  3512.     End If
  3513.   End Sub
  3514.  
  3515.   Sub Search_Click()
  3516.     dim og as new Group
  3517.     dim i,j, hitLevel as integer
  3518.     dim resetCurObject As New SourceSearcher.ResetCurObject
  3519.   
  3520.     ' Show the busy cursor, to indicate we are searching.
  3521.     If App Then App.ShowBusySignal
  3522.   
  3523.     ' Before doing a search, ensure the current module is still valid
  3524.     ' by doing what DropDown does, this may change the search module
  3525.     ModuleCombo_DropDown()
  3526.   
  3527.     searchGroup.Clear()
  3528.     ' Configure the group of objects to search
  3529.     If (SearchModule) Then 
  3530.       SearchModule.GetPrototypeObjects(searchGroup)
  3531.     Else 
  3532.       For i = 0 To ModuleManager.ModuleCount - 1
  3533.         dim om as ObjectModule
  3534.         om = ModuleManager.Module(i)
  3535.         om.GetPrototypeObjects(searchGroup)
  3536.       Next i
  3537.     End If
  3538.   
  3539.     SourceIterator.SearchPattern = SearchCombo.Text
  3540.     If (Not SourceIterator.RegExpValid) Then 
  3541.       Throw RegularExpressionInvalid()
  3542.     End If
  3543.   
  3544.     updateSearch(SearchCombo.Text)
  3545.   
  3546.     HitResults.Clear
  3547.   
  3548.     If (HitFilter.Value) Then hitLevel = 0 Else hitLevel = 2
  3549.   
  3550.     For i = 0 To searchGroup.Count - 1
  3551.       dim hitString as String
  3552.       dim done, curIndex, objIndex, firstObj, firstMethod as integer
  3553.       dim numhits as long
  3554.   
  3555.       curIndex = 0
  3556.   
  3557.       SourceIterator.CurObject = searchGroup(i)
  3558.       SourceIterator.CurMethod = ""
  3559.       firstObj = -1
  3560.       done = 0
  3561.       While SourceIterator.NextMethod() && (Not done)
  3562.         firstMethod = -1
  3563.         While SourceIterator.NextHit() && (Not done)
  3564.   
  3565.           ' Try to keep iterator from running out of memory, by restricting matches.
  3566.           numhits = numhits + 1
  3567.           If (numhits > 200) Then 
  3568.             InfoBox.Message("Too many matches", "The search criteria was too general, and too many matches were found.")
  3569.             Exit Sub
  3570.           End If
  3571.   
  3572.           If (firstObj && (Not (HitFilter.Value = 1))) Then 
  3573.             ' Always insert Objects at index=0, so they sort properly.
  3574.             curIndex = HitResults.InsertItem(SourceIterator.CurObject, 0, 0, 0)
  3575.             HitResults.SetItemCanExpand(curIndex, 1)
  3576.             HitResults.SetItemObject(curIndex, SourceSearcher.ListObject.Create(SourceIterator.CurObject))
  3577.             objIndex = curIndex
  3578.             firstObj = 0
  3579.             If (AutoExpand.Value = 0) Then done = -1 : Exit Do
  3580.           End If
  3581.   
  3582.           If (firstMethod && (Not (HitFilter.Value = 1))) Then 
  3583.             curIndex = HitResults.InsertItem(SourceIterator.CurMethod, 1, 1, objIndex + 1)
  3584.             HitResults.SetItemCanExpand(curIndex, 1)
  3585.             HitResults.SetItemObject(curIndex, SourceSearcher.ListMethod.Create(SourceIterator.CurObject, SourceIterator.CurMethod))
  3586.             firstMethod = 0
  3587.           End If
  3588.           If HitFilter.Value Then 
  3589.             hitString = SourceIterator.CurObject & "::" & SourceIterator.CurMethod & " "
  3590.           Else 
  3591.             hitString = ""
  3592.           End If
  3593.           curIndex = HitResults.InsertItem(hitString & SourceIterator.HitLine & ": " & SourceIterator.HitLineText, 2, hitLevel, curIndex + 1)
  3594.           HitResults.SetItemObject(curIndex, SourceSearcher.ListHit.Create(SourceIterator.CurObject, SourceIterator.CurMethod, SourceIterator.HitStart, SourceIterator.HitLength))
  3595.   
  3596.           SourceIterator.HitStart = SourceIterator.HitStart + 1
  3597.         Wend
  3598.       Wend
  3599.     Next i
  3600.   End Sub
  3601.  
  3602.   Sub updateSearch(s As String)
  3603.     ' Try to find existing item "s", if found don't add again.
  3604.     If SearchCombo.ItemIndex(s) >= 0 Then Exit Sub
  3605.   
  3606.     ' If we have max # of item already, remove oldest item in list.
  3607.     If SearchCombo.ListCount = MaxEntries Then 
  3608.       SearchCombo.RemoveItem(SearchCombo.ListCount - 1)
  3609.     End If
  3610.     ' Add an item at the top of the list
  3611.     SearchCombo.InsertItem(s, 0)
  3612.   End Sub
  3613.  
  3614. End Type
  3615.  
  3616. Type ObjectBoxEditor From ObjectEditor
  3617.   Type ObjBoxForm From Form
  3618.     Type Toolbox From ObjectBox
  3619.       Dim MovePrevious As New ToolGadget
  3620.       Dim MoveNext As New ToolGadget
  3621.       Dim NewGadget As New ToolGadget
  3622.       Type DelGadget From ToolGadget
  3623.         Property HintText Get getHintText As String
  3624.  
  3625.         ' METHODS for object: ObjectBoxEditor.ObjBoxForm.Toolbox.DelGadget
  3626.         Function getHintText As String
  3627.           If Enabled Then 
  3628.             getHintText = "Delete " & Parent.CurrentGadget.Name
  3629.           Else 
  3630.             getHintText = "Delete Selected Gadget"
  3631.           End If
  3632.         End Function
  3633.  
  3634.       End Type
  3635.       Type Configure From ToolGadget
  3636.         Property HintText Get getHintText As String
  3637.  
  3638.         ' METHODS for object: ObjectBoxEditor.ObjBoxForm.Toolbox.Configure
  3639.         Function getHintText As String
  3640.           If Enabled Then 
  3641.             dim EditObj as string
  3642.             EditObj = ObjectBoxEditor.ObjBoxForm.Caption
  3643.             EditObj = Right$(EditObj, Len(EditObj) - Instr(EditObj, ": ") - 1)
  3644.             getHintText = "Configure " & EditObj
  3645.           Else 
  3646.             getHintText = "Configure ObjectBox"
  3647.           End If
  3648.         End Function
  3649.  
  3650.       End Type
  3651.       Type ConfigureTool From ToolGadget
  3652.         Property HintText Get getHintText As String
  3653.  
  3654.         ' METHODS for object: ObjectBoxEditor.ObjBoxForm.Toolbox.ConfigureTool
  3655.         Function getHintText As String
  3656.           If Enabled Then 
  3657.             getHintText = "Configure " & Parent.CurrentGadget.Name
  3658.           Else 
  3659.             getHintText = "Configure Selected Gadget"
  3660.           End If
  3661.         End Function
  3662.  
  3663.       End Type
  3664.       Dim SlidePrevious As New ToolGadget
  3665.       Dim SlideNext As New ToolGadget
  3666.       Dim SeparatorInc As New ToolGadget
  3667.       Dim SeparatorDec As New ToolGadget
  3668.       Dim CurrentGadget As ButtonGadget
  3669.       Dim GadgetPrototype As ButtonGadget
  3670.       Dim ObjBox As ObjectBox
  3671.       Dim EditOnAdd As Boolean
  3672.  
  3673.       ' METHODS for object: ObjectBoxEditor.ObjBoxForm.Toolbox
  3674.       Sub ConfigureTool_Click()
  3675.         CurrentGadget.DetailedEdit
  3676.       End Sub
  3677.  
  3678.       Function ConfigureTool_Enable() as integer
  3679.         If ObjectBoxEditor.Enabled Then 
  3680.           If ObjBox <> Nothing Then 
  3681.             If CurrentGadget <> Nothing Then 
  3682.               ConfigureTool_Enable = True
  3683.             Else 
  3684.               ConfigureTool_Enable = False
  3685.             End If
  3686.           Else 
  3687.             ConfigureTool_Enable = False
  3688.           End If
  3689.         Else 
  3690.           ConfigureTool_Enable = False
  3691.         End If
  3692.       End Function
  3693.  
  3694.       Sub Configure_Click()
  3695.         ObjectBoxConfigWizard.OriginalBox = ObjBox
  3696.         ObjectBoxConfigWizard.Show
  3697.       End Sub
  3698.  
  3699.       Function Configure_Enable() as integer
  3700.         If ObjectBoxEditor.Enabled Then 
  3701.           If ObjBox <> Nothing Then 
  3702.             Configure_Enable = True
  3703.           Else 
  3704.             Configure_Enable = False
  3705.           End If
  3706.         Else 
  3707.           Configure_Enable = False
  3708.         End If
  3709.       End Function
  3710.  
  3711.       Sub DelGadget_Click()
  3712.         Dim YES as integer
  3713.         Dim YN as New YesNoBox
  3714.       
  3715.         YES = 6
  3716.       
  3717.         YN.title = "Verify Delete"
  3718.         YN.message = "Are you sure you want to delete " & CurrentGadget.Name
  3719.       
  3720.         YN.Execute
  3721.       
  3722.         If YN.result = YES Then 
  3723.           dim i as integer
  3724.           i = CurrentGadget.Position
  3725.           DestroyObject(CurrentGadget)
  3726.           If ObjBox.NumItems = 0 Then 
  3727.             CurrentGadget = Nothing
  3728.           Else 
  3729.             If i > ObjBox.NumItems Then 
  3730.               CurrentGadget = ObjBox.At(ObjBox.NumItems)
  3731.             Else 
  3732.               ObjBox.ForceLayout(False)
  3733.               CurrentGadget = ObjBox.At(i)
  3734.             End If
  3735.           End If
  3736.           With Parent.CBGadget
  3737.             If CurrentGadget Then 
  3738.               .Text = CurrentGadget.Name
  3739.             Else 
  3740.               .Text = ""
  3741.             End If
  3742.           End With
  3743.           ObjBox.ForceLayout(True)
  3744.         End If
  3745.       End Sub
  3746.  
  3747.       Function DelGadget_Enable() as integer
  3748.         If ObjectBoxEditor.Enabled Then 
  3749.           If ObjBox <> Nothing Then 
  3750.             If CurrentGadget <> Nothing Then 
  3751.               DelGadget_Enable = True
  3752.             Else 
  3753.               DelGadget_Enable = False
  3754.             End If
  3755.           Else 
  3756.             DelGadget_Enable = False
  3757.           End If
  3758.         Else 
  3759.           DelGadget_Enable = False
  3760.         End If
  3761.       End Function
  3762.  
  3763.       Sub MoveNext_Click()
  3764.         CurrentGadget = ObjBox.At(CurrentGadget.Position + 1)
  3765.         Parent.CBGadget.ListIndex = Parent.CBGadget.ItemIndex(CurrentGadget.Name)
  3766.       End Sub
  3767.  
  3768.       Function MoveNext_Enable() as integer
  3769.         If ObjectBoxEditor.Enabled Then 
  3770.           If ObjBox <> Nothing Then 
  3771.             If ObjBox.NumItems > 1 && CurrentGadget <> Nothing && CurrentGadget.Position < ObjBox.NumItems Then 
  3772.               MoveNext_Enable = True
  3773.             Else 
  3774.               MoveNext_Enable = False
  3775.             End If
  3776.           Else 
  3777.             MoveNext_Enable = False
  3778.           End If
  3779.         Else 
  3780.           MoveNext_Enable = False
  3781.         End If
  3782.       End Function
  3783.  
  3784.       Sub MovePrevious_Click()
  3785.         CurrentGadget = ObjBox.At(CurrentGadget.Position - 1)
  3786.         Parent.CBGadget.ListIndex = Parent.CBGadget.ItemIndex(CurrentGadget.Name)
  3787.       End Sub
  3788.  
  3789.       Function MovePrevious_Enable() as integer
  3790.         If ObjectBoxEditor.Enabled Then 
  3791.           If ObjBox <> Nothing Then 
  3792.             If ObjBox.NumItems > 1 && CurrentGadget <> Nothing && CurrentGadget.Position > 1 Then 
  3793.               MovePrevious_Enable = True
  3794.             Else 
  3795.               MovePrevious_Enable = False
  3796.             End If
  3797.           Else 
  3798.             MovePrevious_Enable = False
  3799.           End If
  3800.         Else 
  3801.           MovePrevious_Enable = False
  3802.         End If
  3803.       End Function
  3804.  
  3805.       Sub NewGadget_Click()
  3806.         CurrentGadget = EmbedObject(ObjBox, GadgetPrototype, UniqueEmbedName(ObjBox, "ToolGadget"))
  3807.         CurrentGadget.bitmap.SetPicture GadgetConfigWizard.BlankBitmap.GetPicture
  3808.         If EditOnAdd Then 
  3809.           dim o as long
  3810.           o = CurrentGadget.DetailedEdit
  3811.           If Not o Then 
  3812.             Dim YN as New YesNoBox
  3813.             YN.title = "Delete Cancelled Add Configuration"
  3814.             YN.message = "Would you like to Delete '" & CurrentGadget.Name & "'?"
  3815.             YN.Execute
  3816.             If YN.result = IDYES Then 
  3817.               DestroyObject(CurrentGadget)
  3818.               If ObjBox.NumItems > 0 Then 
  3819.                 CurrentGadget = ObjBox.At(1)
  3820.               Else 
  3821.                 CurrentGadget = Nothing
  3822.               End If
  3823.             End If
  3824.           End If
  3825.         End If
  3826.         ObjBox.ForceLayout(True)
  3827.       End Sub
  3828.  
  3829.       Function NewGadget_Enable() as integer
  3830.         If ObjectBoxEditor.Enabled Then 
  3831.           If ObjBox <> Nothing Then 
  3832.             NewGadget_Enable = True
  3833.           Else 
  3834.             NewGadget_Enable = False
  3835.           End If
  3836.         Else 
  3837.           NewGadget_Enable = False
  3838.         End If
  3839.       End Function
  3840.  
  3841.       Sub SeparatorDec_Click()
  3842.         If CurrentGadget.Separator > 1 Then 
  3843.           CurrentGadget.Separator = CurrentGadget.Separator - 1
  3844.         Else 
  3845.           CurrentGadget.Separator = 0
  3846.         End If
  3847.       End Sub
  3848.  
  3849.       Sub SeparatorDec_DblClick()
  3850.         If CurrentGadget.Separator > 10 Then 
  3851.           CurrentGadget.Separator = CurrentGadget.Separator - 10
  3852.         Else 
  3853.           CurrentGadget.Separator = 0
  3854.         End If
  3855.       End Sub
  3856.  
  3857.       Function SeparatorDec_Enable() as integer
  3858.         If ObjectBoxEditor.Enabled Then 
  3859.           If ObjBox <> Nothing && ObjBox.LayoutStyle = "ToolBar" && CurrentGadget <> Nothing && CurrentGadget.Separator > 0 Then 
  3860.             SeparatorDec_Enable = True
  3861.           Else 
  3862.             SeparatorDec_Enable = False
  3863.           End If
  3864.         Else 
  3865.           SeparatorDec_Enable = False
  3866.         End If
  3867.       End Function
  3868.  
  3869.       Sub SeparatorInc_Click()
  3870.         CurrentGadget.Separator = CurrentGadget.Separator + 1
  3871.       End Sub
  3872.  
  3873.       Sub SeparatorInc_DblClick()
  3874.         CurrentGadget.Separator = CurrentGadget.Separator + 10
  3875.       End Sub
  3876.  
  3877.       Function SeparatorInc_Enable() as integer
  3878.         If ObjectBoxEditor.Enabled Then 
  3879.           If ObjBox <> Nothing && ObjBox.LayoutStyle = "ToolBar" && CurrentGadget <> Nothing Then 
  3880.             SeparatorInc_Enable = True
  3881.           Else 
  3882.             SeparatorInc_Enable = False
  3883.           End If
  3884.         Else 
  3885.           SeparatorInc_Enable = False
  3886.         End If
  3887.       End Function
  3888.  
  3889.       Sub SlideNext_Click()
  3890.         CurrentGadget.Position = CurrentGadget.Position + 1
  3891.       End Sub
  3892.  
  3893.       Function SlideNext_Enable() as integer
  3894.         If ObjectBoxEditor.Enabled Then 
  3895.           If ObjBox <> Nothing Then 
  3896.             If ObjBox.NumItems > 1 && CurrentGadget <> Nothing && CurrentGadget.Position < ObjBox.NumItems Then 
  3897.               SlideNext_Enable = True
  3898.             Else 
  3899.               SlideNext_Enable = False
  3900.             End If
  3901.           Else 
  3902.             SlideNext_Enable = False
  3903.           End If
  3904.         Else 
  3905.           SlideNext_Enable = False
  3906.         End If
  3907.       End Function
  3908.  
  3909.       Sub SlidePrevious_Click()
  3910.         CurrentGadget.Position = CurrentGadget.Position - 1
  3911.       End Sub
  3912.  
  3913.       Function SlidePrevious_Enable() as integer
  3914.         If ObjectBoxEditor.Enabled Then 
  3915.           If ObjBox <> Nothing Then 
  3916.             If ObjBox.NumItems > 1 && CurrentGadget <> Nothing && CurrentGadget.Position > 1 Then 
  3917.               SlidePrevious_Enable = True
  3918.             Else 
  3919.               SlidePrevious_Enable = False
  3920.             End If
  3921.           Else 
  3922.             SlidePrevious_Enable = False
  3923.           End If
  3924.         Else 
  3925.           SlidePrevious_Enable = False
  3926.         End If
  3927.       End Function
  3928.  
  3929.       Function TextUnload(ByVal indent as string, cmds as string) As Integer
  3930.         cmds = cmds & indent & ".EditOnAdd = " & EditOnAdd & "^J"
  3931.         If GadgetPrototype = Nothing Then 
  3932.           cmds = cmds & indent & ".GadgetPrototype = Nothing^J"
  3933.         Else 
  3934.           cmds = cmds & indent & ".GadgetPrototype = " & GadgetPrototype & "^J"
  3935.         End If
  3936.         ' Request inherited properites to unload also
  3937.         TextUnload = False
  3938.       End Function
  3939.  
  3940.     End Type
  3941.     Type CBGadget From ComboBox
  3942.       Dim SuppressClick As Boolean
  3943.  
  3944.       ' METHODS for object: ObjectBoxEditor.ObjBoxForm.CBGadget
  3945.       Sub Change()
  3946.         dim o as Object
  3947.         o = FindEmbed(Parent.Toolbox.ObjBox, Text)
  3948.         If o && TypeOf o Is ButtonGadget Then ObjectBoxEditor.Edit(o)
  3949.       End Sub
  3950.  
  3951.       Sub Click()
  3952.         If SuppressClick Then 
  3953.           SuppressClick = False
  3954.           Exit Sub
  3955.         End If
  3956.         ObjectBoxEditor.Edit(FindEmbed(Parent.Toolbox.ObjBox, List(ListIndex)))
  3957.       End Sub
  3958.  
  3959.       Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  3960.         If keyCode = VK_RETURN Then 
  3961.           dim o as Object
  3962.           keyCode = 0
  3963.           o = FindEmbed(Parent.Toolbox.ObjBox, Text)
  3964.           If o && TypeOf o Is ButtonGadget Then ObjectBoxEditor.Edit(o)
  3965.         End If
  3966.       End Sub
  3967.  
  3968.     End Type
  3969.  
  3970.     ' METHODS for object: ObjectBoxEditor.ObjBoxForm
  3971.     Sub CBGadget_DropDown()
  3972.       If Toolbox.ObjBox Then 
  3973.         Dim i as integer
  3974.         CBGadget.Clear
  3975.         For i = 1 To Toolbox.ObjBox.NumItems
  3976.           CBGadget.AddItem(Toolbox.ObjBox.At(i).Name)
  3977.         Next i
  3978.         If Toolbox.CurrentGadget && Toolbox.CurrentGadget.Name <> CBGadget.Text Then 
  3979.           CBGadget.SuppressClick = True
  3980.           CBGadget.ListIndex = CBGadget.ItemIndex(Toolbox.CurrentGadget.Name)
  3981.         End If
  3982.       Else 
  3983.         CBGadget.Clear
  3984.       End If
  3985.     End Sub
  3986.  
  3987.     Function getActive As Long
  3988.       If ToolPalette.ToggleObjectBoxEdit.State = "Up" Then 
  3989.         getActive = False
  3990.       Else 
  3991.         getActive = True
  3992.       End If
  3993.     End Function
  3994.  
  3995.     Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  3996.       CBGadget.KeyDown(keyCode, shift)
  3997.     End Sub
  3998.  
  3999.     Sub Resize()
  4000.       CBGadget.Width = ScaleWidth - 4500
  4001.       Height = 840
  4002.       CBGadget.Refresh
  4003.     End Sub
  4004.  
  4005.     Sub SetCaption()
  4006.       Caption = "Editing: "
  4007.       If Toolbox.ObjBox Then 
  4008.         If Toolbox.ObjBox.Name <> "" Then 
  4009.           Caption = Caption & Toolbox.ObjBox.Name
  4010.         Else 
  4011.           Caption = Caption & Toolbox.ObjBox
  4012.         End If
  4013.       Else 
  4014.         Caption = Caption & "NOTHING"
  4015.       End If
  4016.     End Sub
  4017.  
  4018.     Sub SetPrototype
  4019.       If Toolbox.ObjBox = ControlTools.Palette Then 
  4020.         Toolbox.GadgetPrototype = ControlTools.Gadget
  4021.       Else 
  4022.         Toolbox.GadgetPrototype = ToolGadget
  4023.       End If
  4024.     End Sub
  4025.  
  4026.   End Type
  4027.   Property Active Get getActive As Long
  4028.  
  4029.   ' METHODS for object: ObjectBoxEditor
  4030.   Sub Edit(o As Object)
  4031.     If (o && TypeOf o Is ObjectBox) && o <> ObjBoxForm.Toolbox Then 
  4032.       ObjBoxForm.Toolbox.ObjBox = o
  4033.       If o.NumItems > 0 Then 
  4034.         ObjBoxForm.Toolbox.CurrentGadget = o.At(1)
  4035.       Else 
  4036.         ObjBoxForm.Toolbox.CurrentGadget = Nothing
  4037.       End If
  4038.       If Active Then ObjBoxForm.Visible = True
  4039.       SetPrototype
  4040.       ObjBoxForm.SetCaption
  4041.       ObjBoxForm.CBGadget_DropDown
  4042.     ElseIf (o && TypeOf o Is ButtonGadget) && o.Parent Then 
  4043.       If o = ObjBoxForm.Toolbox.CurrentGadget Then 
  4044.       Else 
  4045.         ObjBoxForm.Toolbox.ObjBox = o.Parent
  4046.         ObjBoxForm.Toolbox.CurrentGadget = o
  4047.         If Active Then ObjBoxForm.Visible = True
  4048.         ObjBoxForm.SetPrototype
  4049.         ObjBoxForm.SetCaption
  4050.         ObjBoxForm.CBGadget_DropDown
  4051.       End If
  4052.       ' Make the Editor standout.
  4053.       If Active Then ObjBoxForm.BringToTop
  4054.     End If
  4055.   End Sub
  4056.  
  4057.   Function getActive As Long
  4058.     If ToolPalette.ToggleObjectBoxEdit.State = "Up" Then 
  4059.       getActive = False
  4060.     Else 
  4061.       getActive = True
  4062.     End If
  4063.   End Function
  4064.  
  4065.   Sub SetPrototype
  4066.     If ObjBoxForm.Toolbox.ObjBox = ControlTools.Palette Then 
  4067.       ObjBoxForm.Toolbox.GadgetPrototype = ControlTools.Gadget
  4068.     Else 
  4069.       ObjBoxForm.Toolbox.GadgetPrototype = ToolGadget
  4070.     End If
  4071.   End Sub
  4072.  
  4073. End Type
  4074.  
  4075. Type MenuEditHook From ObjectEditor
  4076.  
  4077.   ' METHODS for object: MenuEditHook
  4078.   Sub BringToTop()
  4079.     MenuEdit.BringToTop()
  4080.   End Sub
  4081.  
  4082.   Sub Edit(obj As Object)
  4083.     If obj && (TypeOf obj Is PopupMenu || TypeOf obj Is MenuBar) Then 
  4084.       MenuEdit.ProcessMenu(obj)
  4085.       MenuEdit.Show
  4086.       MenuEdit.BringToTop
  4087.     End If
  4088.   End Sub
  4089.  
  4090.   Sub Hide()
  4091.     MenuEdit.Hide()
  4092.   End Sub
  4093.  
  4094.   Sub Show()
  4095.     MenuEdit.Show()
  4096.   End Sub
  4097.  
  4098. End Type
  4099.  
  4100. Type EnvelopForm From Form
  4101.   Type EnvelopMenus From MenuBar
  4102.     Dim EnvelopFileMenu As New PopupMenu
  4103.     Dim EnvelopObjectMenu As New PopupMenu
  4104.     Dim EnvelopOptionsMenu As New PopupMenu
  4105.     Dim EnvelopHelpMenu As New PopupMenu
  4106.     Dim EnvelopToolsMenu As New PopupMenu
  4107.   End Type
  4108.   Dim LblEditObj As New Label
  4109.   Type toolbar From ObjectBox
  4110.     Dim NewProject As New ToolGadget
  4111.     Dim OpenProject As New ToolGadget
  4112.     Dim SaveProject As New ToolGadget
  4113.     Dim CloseProject As New ToolGadget
  4114.     Type WorksetLeft From ToolGadget
  4115.  
  4116.       ' METHODS for object: EnvelopForm.toolbar.WorksetLeft
  4117.       Sub Click()
  4118.         WorkSet.PrevObj
  4119.       End Sub
  4120.  
  4121.       Function Enable() As Integer
  4122.         Enable = WorkSet.Active
  4123.       End Function
  4124.  
  4125.     End Type
  4126.     Type Finger From ToolGadget
  4127.       Dim oldCaption As String
  4128.       Dim fingerStarted As Boolean
  4129.       Dim oldAutoBusy As Boolean
  4130.       Dim fingerPointer As Integer
  4131.  
  4132.       ' METHODS for object: EnvelopForm.toolbar.Finger
  4133.       Function FindObjectUnderPoint(x, y as Single) As Object
  4134.         dim p as New Point
  4135.         p.x = x : p.y = y
  4136.         getScreenCoords(p)
  4137.         FindObjectUnderPoint = ObjectTools.FindObjectUnderPoint(p.x, p.y)
  4138.       End Function
  4139.  
  4140.       Sub getScreenCoords(p as Point)
  4141.         p.x = p.x / Screen.TwipsPerPixelX + Left
  4142.         p.y = p.y / Screen.TwipsPerPixelY + Top
  4143.         ClientToScreen(Parent.hWnd, p)
  4144.       End Sub
  4145.  
  4146.       Sub MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
  4147.         If button And 1 && Not fingerStarted Then 
  4148.           fingerStarted = True
  4149.           oldAutoBusy = App.AutoBusySignal
  4150.           App.AutoBusySignal = False
  4151.           Parent.MousePointer = fingerPointer
  4152.           oldCaption = EnvelopForm.Caption
  4153.         End If
  4154.       End Sub
  4155.  
  4156.       Sub MouseMove(button As Integer, shift As Integer, x As Single, y As Single)
  4157.         If button And 1 Then 
  4158.           Dim obj As Object
  4159.           obj = FindObjectUnderPoint(x, y)
  4160.           EnvelopForm.Caption = "Found Object: " & IIf(obj, obj, "Nothing")
  4161.         End If
  4162.       End Sub
  4163.  
  4164.       Sub MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
  4165.         If fingerStarted Then 
  4166.           dim obj as Object
  4167.           fingerStarted = False
  4168.           EnvelopForm.Caption = oldCaption
  4169.           obj = FindObjectUnderPoint(x, y)
  4170.           If obj Then 
  4171.             ' Special case the EnvelopForm to turn Form-Editing off (avoids confusing state)
  4172.             If (obj = EnvelopForm) Then FormEditor.Editing = False
  4173.             ObjectEditorMgr.Edit(obj)
  4174.           End If
  4175.           Parent.MousePointer = "Default"
  4176.           App.AutoBusySignal = oldAutoBusy
  4177.         End If
  4178.       End Sub
  4179.  
  4180.     End Type
  4181.     Type WorksetRight From ToolGadget
  4182.  
  4183.       ' METHODS for object: EnvelopForm.toolbar.WorksetRight
  4184.       Sub Click()
  4185.         WorkSet.NextObj
  4186.       End Sub
  4187.  
  4188.       Function Enable() As Integer
  4189.         Enable = WorkSet.Active
  4190.       End Function
  4191.  
  4192.     End Type
  4193.     Dim NewForm As New ToolGadget
  4194.     Dim CopyObject As New ToolGadget
  4195.     Dim AbstractObject As New ToolGadget
  4196.     Dim DeleteObject As New ToolGadget
  4197.     Type ToggleEdit From ToolGadget
  4198.       Property HintText Get getHintText As String
  4199.  
  4200.       ' METHODS for object: EnvelopForm.toolbar.ToggleEdit
  4201.       Function getHintText As String
  4202.         If FormEditor.Editing Then 
  4203.           getHintText = "Deactivate Form Editor"
  4204.         Else 
  4205.           getHintText = "Activate Form Editor"
  4206.         End If
  4207.       End Function
  4208.  
  4209.     End Type
  4210.     Type RestoreLayout From ToolGadget
  4211.  
  4212.       ' METHODS for object: EnvelopForm.toolbar.RestoreLayout
  4213.       Sub Click()
  4214.         EnvelopLayoutSet.AutoRestoreLayout
  4215.       End Sub
  4216.  
  4217.       Sub DblClick()
  4218.         ScreenLayoutConfigForm.Execute(EnvelopLayoutSet)
  4219.       End Sub
  4220.  
  4221.     End Type
  4222.     Type Help From EnvelopForm.toolbar.Finger
  4223.  
  4224.       ' METHODS for object: EnvelopForm.toolbar.Help
  4225.       Sub Click()
  4226.         EnvelopForm.HelpTopics_Click
  4227.       End Sub
  4228.  
  4229.       Sub MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
  4230.         If fingerStarted Then 
  4231.           dim obj as Object
  4232.           fingerStarted = False
  4233.           EnvelopForm.Caption = oldCaption
  4234.           obj = FindObjectUnderPoint(x, y)
  4235.           If obj Then 
  4236.             If TypeOf obj Is MethodEditor Then 
  4237.               Envelop.Help.ShowTopicHelp("Methods_Browser")
  4238.             ElseIf TypeOf obj Is PropertyEditor Then 
  4239.               Envelop.Help.ShowTopicHelp("Property_Editor")
  4240.             ElseIf obj = ObjectViewer Then 
  4241.               Envelop.Help.ShowTopicHelp("Object_Viewer")
  4242.             ElseIf obj = EnvelopForm Then 
  4243.               Envelop.Help.ShowTopicHelp("Main_Envelop_Menu_and_Toolbar")
  4244.             ElseIf FormEditor.CurForm = obj Then 
  4245.               Envelop.Help.ShowTopicHelp("Form_environment")
  4246.             ElseIf obj = Me Then 
  4247.               ' Do nothing in particular, wait for Click event.
  4248.             Else 
  4249.               Envelop.Help.ShowObjectHelp(obj)
  4250.             End If
  4251.           End If
  4252.           Parent.MousePointer = "Default"
  4253.           App.AutoBusySignal = oldAutoBusy
  4254.         End If
  4255.       End Sub
  4256.  
  4257.     End Type
  4258.     Dim NewObject As New ToolGadget
  4259.  
  4260.     ' METHODS for object: EnvelopForm.toolbar
  4261.     Sub DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  4262.       effect = 0
  4263.     End Sub
  4264.  
  4265.   End Type
  4266.   Type CBSelectedObject From ComboBox
  4267.  
  4268.     ' METHODS for object: EnvelopForm.CBSelectedObject
  4269.     Sub Click()
  4270.       Dim editObj as Object
  4271.     
  4272.       editObj = FindObject(List(ListIndex))
  4273.       If Not editObj Then Exit Sub
  4274.       ObjectEditorMgr.ResetOthers(WorkSet, editObj)
  4275.     End Sub
  4276.  
  4277.     Sub Edit(obj as Object)
  4278.       dim name as String
  4279.       dim grpObj as Object
  4280.       dim idx as Long
  4281.     
  4282.       If Not obj Then 
  4283.         Exit Sub
  4284.       End If
  4285.     
  4286.       name = obj
  4287.       idx = ItemIndex(name)
  4288.       If (idx <> -1) Then 
  4289.         RemoveItem(idx)
  4290.       End If
  4291.       If (ListCount >= 10) Then RemoveItem(ListCount - 1)
  4292.     
  4293.       InsertItem(name, 0)
  4294.       ' Make the combo select the just entered item, by setting Text property.
  4295.       ' this avoids the "Click" event which would result from setting ListIndex.
  4296.       Text = name
  4297.     End Sub
  4298.  
  4299.     Sub EditByName(nm as String)
  4300.       Dim obj as Object
  4301.       obj = FindObject(nm)
  4302.       ' Special case the EnvelopForm to turn Form-Editing off (avoids confusing state)
  4303.       If (obj = EnvelopForm) Then FormEditor.Editing = False
  4304.       If obj Then ObjectEditorMgr.Edit obj
  4305.     End Sub
  4306.  
  4307.     Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  4308.       If keyCode = VK_RETURN Then 
  4309.         keyCode = 0
  4310.         EditByName(Text)
  4311.       End If
  4312.     End Sub
  4313.  
  4314.     Sub KeyUp(keyCode As Integer, ByVal shift As Integer)
  4315.       ' Special case having a "." for last typed char, so that
  4316.       ' composite names like "A.B" can be type if "A" is already in list.
  4317.       If (Right(Text, 1) <> ".") Then SelectNamed(Text)
  4318.     End Sub
  4319.  
  4320.     Sub Selection(obj as Object)
  4321.       If obj Then 
  4322.         Dim name as String
  4323.         name = obj
  4324.         If Text <> name Then 
  4325.           Text = obj
  4326.         End If
  4327.       End If
  4328.     End Sub
  4329.  
  4330.     Sub SelectNamed(nm As String)
  4331.       Dim obj as Object
  4332.       obj = FindObject(nm)
  4333.       If ObjectViewer.SelObject <> obj Then ObjectViewer.SelObject = Nothing
  4334.       ObjectEditorMgr.Selection obj
  4335.     End Sub
  4336.  
  4337.   End Type
  4338.  
  4339.   ' METHODS for object: EnvelopForm
  4340.   Sub About_Click()
  4341.     AboutEnvelopForm.Execute()
  4342.   End Sub
  4343.  
  4344.   Sub AbstractObject_Click()
  4345.     Dim nm, rootNm, newNm as String
  4346.     Dim old, abso as Object
  4347.     Dim r as Long
  4348.     old = ObjectEditorMgr.SelectedObject
  4349.     r = InputDialog.Execute("Abstract Object", "Enter name to give new prototype of " & old & ":", UniqueObjectName(old))
  4350.     If r <> IDOK Then Exit Sub
  4351.     newNm = InputDialog.Text
  4352.     If IsIdentifierValid(newNm) = 0 Then 
  4353.       Dim mb As New MessageBox
  4354.       mb.SetIconExclamation
  4355.       mb.Message("Invalid identifier", """" & newNm & """ is not a valid object name")
  4356.       Exit Sub
  4357.     End If
  4358.   
  4359.     rootNm = ObjectTools.RootName(old)
  4360.   
  4361.     ' Abstract object and reset viewers and editors
  4362.     abso = ObjectTools.AbstractObject(old, newNm)
  4363.     ObjectViewer.ResetAbstract(abso)
  4364.     ObjectEditorMgr.Edit abso
  4365.   
  4366.     ' If original was an embedded control with prefixed name,
  4367.     ' change original's prefixed name to reflect new type
  4368.     If TypeOf old Is Window && old.Parent Then 
  4369.       If Instr(old.Name, rootNm) = 1 && Val(Mid(old.Name, Len(rootNm) + 1)) Then 
  4370.         rootNm = ObjectTools.RootName(old)
  4371.         old.Name = UniqueEmbedName(old.Parent, rootNm)
  4372.       End If
  4373.     End If
  4374.     If TypeOf old Is HyperControl && old.Parent Then 
  4375.       abso.Caption = abso
  4376.       abso.Move(abso.Left, abso.Top, old.Width + (abso.Width - abso.ScaleWidth), old.Height + (abso.Height - abso.ScaleHeight))
  4377.     End If
  4378.   End Sub
  4379.  
  4380.   Function AbstractObject_Enable() As Integer
  4381.     AbstractObject_Enable = (ObjectEditorMgr.SelectedObject <> Nothing)
  4382.   End Function
  4383.  
  4384.   Sub AppEditor_Click()
  4385.     ApplicationEditor.Visible = Not ApplicationEditor.Visible
  4386.   End Sub
  4387.  
  4388.   Function AppEditor_Enable() As Integer
  4389.     AppEditor_Enable = True
  4390.     EnvelopMenus.EnvelopToolsMenu.CheckItem("AppEditor", ApplicationEditor.Visible)
  4391.   End Function
  4392.  
  4393.   Sub CBSelectedObject_DropDown()
  4394.     WorkSet.CleanList
  4395.   End Sub
  4396.  
  4397.   Sub CloseAll_Click()
  4398.     PropertyEditor.Hide
  4399.     MethodEditor.Hide
  4400.     ObjectViewer.Hide
  4401.     SourceSearcher.Hide
  4402.     ToolPalette.Hide
  4403.     ControlTools.Palette.Hide
  4404.     Debug.Hide
  4405.     MenuEdit.Hide
  4406.     MenuTester.Hide
  4407.     GroupEditor.Hide
  4408.     ApplicationEditor.Hide
  4409.     WorkSet.Hide
  4410.   End Sub
  4411.  
  4412.   Sub CloseProject_Click
  4413.     ObjectViewer.CloseProject_Click
  4414.   End Sub
  4415.  
  4416.   Function CloseProject_Enable() As Integer
  4417.     Dim enable As Integer
  4418.     enable = ObjectViewer.CloseProject_Enable
  4419.     If enable Then 
  4420.       toolbar.CloseProject.HintText = "Close project: " & ProjectManager.CurrentProject
  4421.     Else 
  4422.       toolbar.CloseProject.HintText = "Close project"
  4423.     End If
  4424.     CloseProject_Enable = enable
  4425.   End Function
  4426.  
  4427.   Sub ConfigureLayout_Click()
  4428.     ScreenLayoutConfigForm.Execute EnvelopLayoutSet
  4429.   End Sub
  4430.  
  4431.   Sub ControlPalette_Click()
  4432.     ControlTools.Palette.Visible = Not ControlTools.Palette.Visible
  4433.   End Sub
  4434.  
  4435.   Function ControlPalette_Enable() As Integer
  4436.     ControlPalette_Enable = True
  4437.     EnvelopMenus.EnvelopToolsMenu.CheckItem("ControlPalette", ControlTools.Palette.Visible)
  4438.   End Function
  4439.  
  4440.   Sub CopyObject_Click()
  4441.     Dim o as Object
  4442.   
  4443.     ' Try to get the FormEditor or the ObjectViewer to do the copy.
  4444.     o = ObjectEditorMgr.SelectedObject
  4445.     If (Not FormEditorCopy(o)) && (Not ObjectViewer.CopyObjectQuick(o, False)) Then 
  4446.       ' Just do it ourselves
  4447.       Dim r as Long
  4448.       r = InputDialog.Execute("Copy Object", "Enter name for new object:", UniqueObjectName(o))
  4449.       If r = IDOK && Len(InputDialog.Text) > 0 Then CopyObject(o, InputDialog.Text)
  4450.     End If
  4451.   End Sub
  4452.  
  4453.   Function CopyObject_Enable() As Integer
  4454.     CopyObject_Enable = (ObjectEditorMgr.SelectedObject <> Nothing)
  4455.   End Function
  4456.  
  4457.   Sub DebugWindow_Click()
  4458.     Debug.Visible = Not Debug.Visible
  4459.   End Sub
  4460.  
  4461.   Function DebugWindow_Enable() As Integer
  4462.     DebugWindow_Enable = True
  4463.     EnvelopMenus.EnvelopToolsMenu.CheckItem("DebugWindow", Debug.Visible)
  4464.   End Function
  4465.  
  4466.   Sub DeleteObject_Click()
  4467.     Dim o as Object
  4468.     Dim msg as String
  4469.   
  4470.     o = ObjectEditorMgr.SelectedObject
  4471.   
  4472.     ' Try to get the FormEditor to do the delete.
  4473.     Try
  4474.       If TypeOf o Is Window && o.Parent = FormEditor.CurForm Then 
  4475.         Dim i, n as Integer
  4476.   
  4477.         ObjectViewer.SelObject = o.Parent
  4478.         n = FormEditor.NumSelected - 1
  4479.         For i = 0 To n
  4480.           If FormEditor.GetSelected(i) = o Then 
  4481.             msg = "Destroy selected control" & IIf(FormEditor.NumSelected > 1, "s?", "?")
  4482.             If OKCancelBox.Message("Destroy Object", msg) <> IDOK Then Exit Sub
  4483.             ' If the FormEditor can delete this object, let it.  Otherwise
  4484.             ' let the ObjectViewer try.
  4485.             ' The FormEditor will delete all selected controls
  4486.             FormEditor.DeleteControl(Nothing)
  4487.             Exit Sub
  4488.           End If
  4489.         Next i
  4490.       End If
  4491.     Catch
  4492.     End Try
  4493.   
  4494.     msg = "Destroy object '" & o & "' ?"
  4495.     If OKCancelBox.Message("Destroy Object", msg) <> IDOK Then Exit Sub
  4496.   
  4497.     ' Alert the user if we are deleting an object that has copies of itself in existence
  4498.     If ObjectHasCopies(o) Then 
  4499.       msg = "The object '" & o & "' has copies of itself that will also be deleted.^M^J OK to continue?"
  4500.       If OKCancelBox.Message("Destroy Object", msg) <> IDOK Then Exit Sub
  4501.     End If
  4502.   
  4503.     ' Try to get the ObjectViewer to do the delete
  4504.     ' 
  4505.     ' If the ObjectViewer can delete this object, let it.  Otherwise
  4506.     ' delete it ourselves.
  4507.     If Not ObjectViewer.DestroySelectedObject(o) Then 
  4508.       ' Just do it ourselves
  4509.       DestroyObject(o)
  4510.       ObjectEditorMgr.Selection ObjectViewer.SelObject
  4511.     End If
  4512.   End Sub
  4513.  
  4514.   Function DeleteObject_Enable() As Integer
  4515.     DeleteObject_Enable = ObjectEditorMgr.SelectedObject && CanDeleteObject(ObjectEditorMgr.SelectedObject)
  4516.   End Function
  4517.  
  4518.   Sub DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  4519.     If state = 4 Then 
  4520.       ModuleManager.LoadModule(source.FileName, False)
  4521.       ObjectViewer.Reset
  4522.     Else 
  4523.       effect = 0
  4524.     End If
  4525.   End Sub
  4526.  
  4527.   Function FormEditorCopy(o As Object) As Boolean
  4528.     ' Try to get the FormEditor to do the copy.
  4529.     Try
  4530.       Dim p as Form
  4531.       Dim i, n as Integer
  4532.   
  4533.       p = o.Parent
  4534.       If p <> FormEditor.CurForm Then Throw No
  4535.       n = FormEditor.NumSelected - 1
  4536.       For i = 0 To n
  4537.         If FormEditor.GetSelected(i) = o Then Exit For
  4538.       Next i
  4539.       If i > n Then Throw No
  4540.       FormEditor.CopyControls
  4541.       FormEditorCopy = True
  4542.       Exit Function
  4543.     Catch
  4544.     End Try
  4545.     FormEditorCopy = False
  4546.   End Function
  4547.  
  4548.   Sub GroupEditor_Click()
  4549.     GroupEditor.Visible = Not GroupEditor.Visible
  4550.   End Sub
  4551.  
  4552.   Function GroupEditor_Enable() As Integer
  4553.     GroupEditor_Enable = True
  4554.     EnvelopMenus.EnvelopToolsMenu.CheckItem("GroupEditor", GroupEditor.Visible)
  4555.   End Function
  4556.  
  4557.   Sub HelpSamples_Click()
  4558.     SamplesBrowser.Show
  4559.     SamplesBrowser.BringToTop
  4560.   End Sub
  4561.  
  4562.   Sub HelpTopics_Click()
  4563.     Envelop.Help.HelpTopics
  4564.   End Sub
  4565.  
  4566.   Sub KeyDown(keyCode As Integer, ByVal shift As Integer)
  4567.     CBSelectedObject.KeyDown(keyCode, shift)
  4568.     If (keyCode = VK_F1) Then Envelop.Help.ShowTopicHelp("Main_Envelop_Menu_and_Toolbar")
  4569.   End Sub
  4570.  
  4571.   Sub Load()
  4572.     ' Secure this object to prevent deletion.
  4573.     ' TODO: Need to specify can't delete or rename security, can't use general, because
  4574.     ' then methods and properties can't be changed either.
  4575.     ' SecureObject(Me, ACL)
  4576.   
  4577.     ' TODO: Patch to prevent selected combo being hidden by toolbar
  4578.     EnvelopForm.CBSelectedObject.ZOrder = 1
  4579.   
  4580.     ' Hide the project startup dialog, doesn't matter if it didn't show
  4581.     ProjectStartupDialog.Hide
  4582.   
  4583.     ' Display the object viewer; take care of project startup etc.
  4584.     ObjectViewer.Startup
  4585.   
  4586.     ' Restore default layout or best layout for current screen resolution.
  4587.     EnvelopLayoutSet.AutoRestoreLayout()
  4588.   
  4589.     ' Overcome a timing problem with making the default object "Form1" and restoring
  4590.     ' the layout position of the object it copies from "Form".
  4591.     ' Ummm, but only do this if we just made a new or default project! Otherwise we
  4592.     ' might move someone's Form1 in a project they just opened.
  4593.     With ProjectStartupOptions
  4594.       If .StartupAction = .ACTION_NEW_PROJECT || .StartupAction = .ACTION_DEFAULT_PROJECT Then 
  4595.         If FindObject("Form1") Then Form1.Move(Form.Left, Form.Top, Form.Width, Form.Height)
  4596.       End If
  4597.     End With
  4598.   
  4599.     ' Set the module index of the Envelop objects, to keep Debugger from
  4600.     ' trapping exceptions that occur in code run from these objects.
  4601.     Debugger.IgnoreExceptionsModule = ModuleManager.ModuleContaining(Me).Selector
  4602.   
  4603.   End Sub
  4604.  
  4605.   Sub LoadModule_Click()
  4606.     ObjectViewer.LoadModule_Click
  4607.   End Sub
  4608.  
  4609.   Sub MenuEditor_Click()
  4610.     MenuEdit.Visible = Not MenuEdit.Visible
  4611.   End Sub
  4612.  
  4613.   Function MenuEditor_Enable() As Integer
  4614.     MenuEditor_Enable = True
  4615.     EnvelopMenus.EnvelopToolsMenu.CheckItem("MenuEditor", MenuEdit.Visible)
  4616.   End Function
  4617.  
  4618.   Sub MergeModule_Click()
  4619.     Envelop.ETOOpen.MergeEto
  4620.   End Sub
  4621.  
  4622.   Sub MethodBrowser_Click()
  4623.     MethodEditor.Visible = Not MethodEditor.Visible
  4624.   End Sub
  4625.  
  4626.   Function MethodBrowser_Enable() As Integer
  4627.     MethodBrowser_Enable = True
  4628.     EnvelopMenus.EnvelopToolsMenu.CheckItem("MethodBrowser", MethodEditor.Visible)
  4629.   End Function
  4630.  
  4631.   Sub MoveObject_Click()
  4632.     ObjectViewer.MoveObject_Click
  4633.   End Sub
  4634.  
  4635.   Function MoveObject_Enable() As Integer
  4636.     ' Set menu item to show an informative string...
  4637.     Dim enable As Boolean
  4638.     Dim pos As Integer
  4639.     Dim itemStr As String
  4640.     enable = ObjectViewer.MoveObject_Enable
  4641.     pos = EnvelopMenus.EnvelopObjectMenu.ItemPosition("MoveObject")
  4642.     itemStr = "Move to " & IIf(enable, ModuleManager.CurrentModule.DisplayName, "Current Module")
  4643.     EnvelopMenus.EnvelopObjectMenu.SetCaption(pos, itemStr)
  4644.     MoveObject_Enable = enable
  4645.   End Function
  4646.  
  4647.   Sub NewForm_Click()
  4648.     Dim f as Form
  4649.     Dim nm as String
  4650.   
  4651.     nm = UniqueObjectNameFromString("Form")
  4652.     f = CopyObject(Form, nm)
  4653.     f.Caption = nm
  4654.   
  4655.     FormEditor.Editing = True
  4656.     ObjectEditorMgr.Edit f
  4657.     ObjectViewer.ResetNewObject(f)
  4658.   End Sub
  4659.  
  4660.   Sub NewModule_Click()
  4661.     ObjectViewer.NewModule_Click
  4662.   End Sub
  4663.  
  4664.   Sub NewObject_Click()
  4665.     ObjectViewer.NewObject_Click
  4666.   End Sub
  4667.  
  4668.   Sub NewProject_Click
  4669.     ObjectViewer.NewProject_Click
  4670.   End Sub
  4671.  
  4672.   Sub ObjectBrowser_Click()
  4673.     ObjectViewer.Visible = Not ObjectViewer.Visible
  4674.   End Sub
  4675.  
  4676.   Function ObjectBrowser_Enable() As Integer
  4677.     ObjectBrowser_Enable = True
  4678.     EnvelopMenus.EnvelopToolsMenu.CheckItem("ObjectBrowser", ObjectViewer.Visible)
  4679.   End Function
  4680.  
  4681.   Sub OpenProject_Click
  4682.     ObjectViewer.OpenProject_Click
  4683.   End Sub
  4684.  
  4685.   Sub PropertyEditor_Click()
  4686.     PropertyEditor.Visible = Not PropertyEditor.Visible
  4687.   End Sub
  4688.  
  4689.   Function PropertyEditor_Enable() As Integer
  4690.     PropertyEditor_Enable = True
  4691.     EnvelopMenus.EnvelopToolsMenu.CheckItem("PropertyEditor", PropertyEditor.Visible)
  4692.   End Function
  4693.  
  4694.   Sub QuickCopy_Click()
  4695.     Dim o as Object
  4696.   
  4697.     ' Try to get the FormEditor or the ObjectViewer to do the copy.
  4698.     o = ObjectEditorMgr.SelectedObject
  4699.     If (Not FormEditorCopy(o)) && (Not ObjectViewer.CopyObjectQuick(o, True)) Then 
  4700.       ' Just do it ourselves
  4701.       CopyObject(o, UniqueObjectName(o))
  4702.     End If
  4703.   End Sub
  4704.  
  4705.   Function QuickCopy_Enable() As Integer
  4706.     QuickCopy_Enable = (ObjectEditorMgr.SelectedObject <> Nothing)
  4707.   End Function
  4708.  
  4709.   Sub QuitApp_Click()
  4710.     App.Quit
  4711.   End Sub
  4712.  
  4713.   Sub RenameObject_Click()
  4714.     Dim o as Object
  4715.     Dim nm as String
  4716.   
  4717.     o = ObjectEditorMgr.SelectedObject
  4718.     nm = o
  4719.     If Instr(nm, ".") Then nm = stripEmbedName(nm)
  4720.   
  4721.     If InputDialog.Execute("Rename Object", "Enter new name for object:", nm) = IDOK Then 
  4722.       Dim newName As String
  4723.       newName = InputDialog.Text
  4724.       If IsIdentifierValid(newName) = 0 Then 
  4725.         Dim mb As New MessageBox
  4726.         mb.SetIconExclamation
  4727.         mb.Message("Invalid identifier", """" & newName & """ is not a valid object name")
  4728.         Exit Sub
  4729.       End If
  4730.   
  4731.       Try
  4732.         If HostObject(o) Then 
  4733.           ' The object to rename is an Embedded object, so unless the ObjectViewer is showing
  4734.           ' embeds we can just do the rename like this.
  4735.           If TypeOf o Is Control Then 
  4736.             ' Use Name property for these guys, Name doesn't always work on Forms
  4737.             o.Name = newName
  4738.           Else 
  4739.             RenameObject(o, newName)
  4740.           End If
  4741.         ElseIf Not ObjectViewer.RenameSelectedObject(o, newName) Then 
  4742.           ' If the ObjectViewer can't be shown for example...
  4743.           RenameObject(o, newName)
  4744.         End If
  4745.       Catch
  4746.         InfoBox.Message("Rename failed", "The name " & newName & " is already in use.")
  4747.       End Try
  4748.       ObjectEditorMgr.Selection(o)
  4749.     End If
  4750.   End Sub
  4751.  
  4752.   Function RenameObject_Enable() As Integer
  4753.     Dim obj As Object
  4754.     obj = ObjectEditorMgr.SelectedObject
  4755.     RenameObject_Enable = obj && (Not IsDynamic(obj)) && ((TypeOf obj Is Project) || CanDeleteObject(obj))
  4756.   End Function
  4757.  
  4758.   Sub Resize()
  4759.     dim lastGad As ButtonGadget
  4760.     dim minLeft, newLeft As Single
  4761.     dim overhang as single
  4762.     dim comboWidth, minCombo, maxCombo, availWidth, desiredWidth As Single
  4763.     ' Define the min/max widths of the Selected Object Combo (CBSelectedObject)
  4764.     minCombo = 2200
  4765.     maxCombo = 3315
  4766.   
  4767.     ' Set the inside-height of the Form to be just shy of the toolbar height
  4768.     ' (hides border pixel).
  4769.     Height = (Height - ScaleHeight) + toolbar.Height - 30
  4770.   
  4771.     ' Reposition the Toolbar to cover entire client area.
  4772.     toolbar.Move(-30, -30, ScaleWidth + 30, toolbar.Height)
  4773.   
  4774.     ' Figure out width of "used" portion of Toolbar (i.e. right edge of last gadget)
  4775.     lastGad = EnvelopForm.toolbar.At(EnvelopForm.toolbar.NumItems)
  4776.     minLeft = EnvelopForm.toolbar.Left + (lastGad.Left + lastGad.bitmap.Width) * Screen.TwipsPerPixelX + 150
  4777.   
  4778.     ' Compute some stuff
  4779.     comboWidth = maxCombo
  4780.     availWidth = ScaleWidth - minLeft
  4781.     desiredWidth = LblEditObj.Width + 75 + comboWidth + 75
  4782.     If (availWidth < desiredWidth) Then 
  4783.       ' Ok, something has to give, reduce the size of the ComboBox as much as possible/needed
  4784.       comboWidth = comboWidth - (desiredWidth - availWidth)
  4785.       If (comboWidth < minCombo) Then comboWidth = minCombo
  4786.     End If
  4787.     CBSelectedObject.Width = comboWidth
  4788.   
  4789.     ' Figure out where CBSelectedObject combo should go.
  4790.     newLeft = ScaleWidth - CBSelectedObject.Width - 75
  4791.     If (newLeft < minLeft) Then newLeft = minLeft
  4792.     CBSelectedObject.Left = newLeft
  4793.   
  4794.     ' Compute where Label "Selected:" should go, try to place just to the left of the
  4795.     ' ComboBox, but not past the absolute minimum Left position "minLeft"
  4796.     newLeft = CBSelectedObject.Left - LblEditObj.Width - 75
  4797.     If (newLeft < minLeft) Then 
  4798.       newLeft = minLeft
  4799.     End If
  4800.     ' Because the ZOrder of the Label is lower than the SelectedCombo, it will appear under
  4801.     ' the combo, giving priority to the SelectedCombo, if they overlap.
  4802.     LblEditObj.Left = newLeft
  4803.   End Sub
  4804.  
  4805.   Sub RestoreBestLayout()
  4806.     dim layoutName As String
  4807.     dim layout As ScreenLayout
  4808.   
  4809.     ' Using the dimensions reported by the Screen object, figure out which
  4810.     ' pre-recorded layout would best fit the screen resolution.
  4811.     layoutName = "EnvelopForm.ScreenLayout" & Screen.pixelWidth & "x" & Screen.pixelHeight
  4812.     layout = FindObject(layoutName)
  4813.     If layout Then layout.RestoreLayout
  4814.   End Sub
  4815.  
  4816.   Sub SaveAll_Click()
  4817.     ObjectViewer.SaveAll_Click
  4818.   End Sub
  4819.  
  4820.   Function SaveAll_Enable() As Integer
  4821.     SaveAll_Enable = ObjectViewer.SaveAll_Enable
  4822.   End Function
  4823.  
  4824.   Sub SaveModuleAs_Click()
  4825.     ObjectViewer.SaveModuleAs_Click
  4826.   End Sub
  4827.  
  4828.   Function SaveModuleAs_Enable() As Integer
  4829.     SaveModuleAs_Enable = ObjectViewer.SaveModuleAs_Enable
  4830.   End Function
  4831.  
  4832.   Sub SaveModule_Click()
  4833.     ObjectViewer.SaveModule_Click
  4834.   End Sub
  4835.  
  4836.   Function SaveModule_Enable() As Integer
  4837.     Dim om as ObjectModule
  4838.     om = ObjectViewer.SelModule
  4839.     SaveModule_Enable = Not om.ReadOnly && om.IsModified
  4840.   End Function
  4841.  
  4842.   Sub SaveProjectAs_Click
  4843.     ObjectViewer.SaveProjectAs_Click
  4844.   End Sub
  4845.  
  4846.   Function SaveProjectAs_Enable As Integer
  4847.     SaveProjectAs_Enable = ObjectViewer.SaveProjectAs_Enable
  4848.   End Function
  4849.  
  4850.   Sub SaveProject_Click
  4851.     ObjectViewer.SaveProject_Click
  4852.   End Sub
  4853.  
  4854.   Function SaveProject_Enable As Integer
  4855.     Dim enable As Integer
  4856.     enable = ObjectViewer.SaveProject_Enable
  4857.     If enable Then 
  4858.       toolbar.SaveProject.HintText = "Save project: " & ProjectManager.CurrentProject
  4859.     Else 
  4860.       toolbar.SaveProject.HintText = "Save project"
  4861.     End If
  4862.     SaveProject_Enable = enable
  4863.   End Function
  4864.  
  4865.   Sub SourceBrowser_Click()
  4866.     SourceSearcher.Visible = Not SourceSearcher.Visible
  4867.   End Sub
  4868.  
  4869.   Function SourceBrowser_Enable() As Integer
  4870.     SourceBrowser_Enable = True
  4871.     EnvelopMenus.EnvelopToolsMenu.CheckItem("SourceBrowser", SourceSearcher.Visible)
  4872.   End Function
  4873.  
  4874.   Sub StartupOptions_Click()
  4875.     ProjectStartupOptionsDialog.Execute
  4876.   End Sub
  4877.  
  4878.   Function stripEmbedName(nm As String) As String
  4879.     Dim pos, lastdot As Integer
  4880.   
  4881.     ' Find last "." in name
  4882.     pos = Instr(nm, ".")
  4883.     lastdot = pos
  4884.     While (pos)
  4885.       pos = Instr(pos + 1, nm, ".")
  4886.       If (pos) Then lastdot = pos
  4887.     Wend
  4888.     stripEmbedName = Mid(nm, lastdot + 1)
  4889.   End Function
  4890.  
  4891.   Sub ToggleEdit_Click()
  4892.     FormEditor.Editing = Not FormEditor.Editing
  4893.     toolbar.ToggleEdit.State = IIf(FormEditor.Editing, "Down", "Up")
  4894.   End Sub
  4895.  
  4896.   Function ToggleEdit_Enable() As Integer
  4897.     ToggleEdit_Enable = True
  4898.     toolbar.ToggleEdit.State = IIf(FormEditor.Editing, "Down", "Up")
  4899.     EnvelopMenus.EnvelopOptionsMenu.CheckItem("ToggleEdit", FormEditor.Editing)
  4900.   End Function
  4901.  
  4902.   Sub ToolPalette_Click()
  4903.     ToolPalette.Visible = Not ToolPalette.Visible
  4904.   End Sub
  4905.  
  4906.   Function ToolPalette_Enable() As Integer
  4907.     ToolPalette_Enable = True
  4908.     EnvelopMenus.EnvelopToolsMenu.CheckItem("ToolPalette", ToolPalette.Visible)
  4909.   End Function
  4910.  
  4911.   Sub TrapInterp_Click()
  4912.     If (EnvelopMenus.EnvelopOptionsMenu.ItemIsChecked("TrapInterp")) Then 
  4913.       Debugger.TrapInterpretiveExceptions = False
  4914.     Else 
  4915.       Debugger.TrapInterpretiveExceptions = True
  4916.     End If
  4917.     EnvelopMenus.EnvelopOptionsMenu.CheckItem("TrapInterp", Debugger.TrapInterpretiveExceptions)
  4918.   End Sub
  4919.  
  4920.   Function TrapInterp_Enable() As Integer
  4921.     TrapInterp_Enable = True
  4922.     EnvelopMenus.EnvelopOptionsMenu.CheckItem("TrapInterp", Debugger.TrapInterpretiveExceptions)
  4923.     TrapInterp_Enable = Debugger.Available
  4924.   End Function
  4925.  
  4926.   Sub TrapSys_Click()
  4927.     If (EnvelopMenus.EnvelopOptionsMenu.ItemIsChecked("TrapSys")) Then 
  4928.       Debugger.TrapSystemExceptions = False
  4929.     Else 
  4930.       Debugger.TrapSystemExceptions = True
  4931.     End If
  4932.     EnvelopMenus.EnvelopOptionsMenu.CheckItem("TrapSys", Debugger.TrapSystemExceptions)
  4933.   End Sub
  4934.  
  4935.   Function TrapSys_Enable() As Integer
  4936.     EnvelopMenus.EnvelopOptionsMenu.CheckItem("TrapSys", Debugger.TrapSystemExceptions)
  4937.     TrapSys_Enable = Debugger.Available
  4938.   End Function
  4939.  
  4940.   Sub UnloadModule_Click()
  4941.     ObjectViewer.UnloadModule_Click
  4942.   End Sub
  4943.  
  4944.   Function UnloadModule_Enable() As Integer
  4945.     UnloadModule_Enable = ObjectViewer.UnloadModule_Enable
  4946.   End Function
  4947.  
  4948.   Sub WorkSet_Click()
  4949.     WorkSet.Visible = Not WorkSet.Visible
  4950.   End Sub
  4951.  
  4952.   Function WorkSet_Enable() As Integer
  4953.     WorkSet_Enable = True
  4954.     EnvelopMenus.EnvelopToolsMenu.CheckItem("WorkSet", WorkSet.Visible)
  4955.   End Function
  4956.  
  4957.   Sub WriteText_Click()
  4958.     Envelop.SADlg.WriteObjectAsText(ObjectEditorMgr.SelectedObject)
  4959.   End Sub
  4960.  
  4961.   Function WriteText_Enable() As Integer
  4962.     WriteText_Enable = (ObjectEditorMgr.SelectedObject <> Nothing)
  4963.   End Function
  4964.  
  4965. End Type
  4966.  
  4967. Type ObjDebug From ObjDebug
  4968. End Type
  4969.  
  4970. Type ProjectStartupDialog From Form
  4971.   Dim BTNOpenProject As New Button
  4972.   Type BTNNewProject From Button
  4973.     Dim font1 As New Font
  4974.   End Type
  4975.   Dim BTNNoProject As New Button
  4976.   Dim LblNewProject As New Label
  4977.   Dim LblNoProject As New Label
  4978.   Dim LblOpenProject As New Label
  4979.   Type LblHeader From Label
  4980.     Dim font As New Font
  4981.   End Type
  4982.   Dim font1 As New Font
  4983.  
  4984.   ' METHODS for object: ProjectStartupDialog
  4985.   Sub Activate
  4986.     LblHeader.BackColor = GetSysColor(COLOR_ACTIVECAPTION)
  4987.     LblHeader.ForeColor = GetSysColor(COLOR_CAPTIONTEXT)
  4988.   End Sub
  4989.  
  4990.   Sub BTNNewProject_Click()
  4991.     ModalResult(ProjectStartupOptions.ACTION_NEW_PROJECT)
  4992.   End Sub
  4993.  
  4994.   Sub BTNNoProject_Click()
  4995.     ModalResult(ProjectStartupOptions.ACTION_NO_PROJECT)
  4996.   End Sub
  4997.  
  4998.   Sub BTNOpenProject_Click()
  4999.     ModalResult(ProjectStartupOptions.ACTION_OPEN_PROJECT)
  5000.   End Sub
  5001.  
  5002.   Sub Deactivate
  5003.     LblHeader.BackColor = GetSysColor(COLOR_INACTIVECAPTION)
  5004.     LblHeader.ForeColor = GetSysColor(COLOR_INACTIVECAPTIONTEXT)
  5005.   End Sub
  5006.  
  5007.   Sub Execute
  5008.     If ProjectStartupOptions.AskOnStartup Then 
  5009.       Center
  5010.       ProjectStartupOptions.StartupAction = ShowModal
  5011.     End If
  5012.   End Sub
  5013.  
  5014. End Type
  5015.  
  5016. Type AboutEnvelopForm From Form
  5017.   Dim bitmap As New Bitmap
  5018.   Dim imgAbout As New Image
  5019.   Type lstDLLs From ListBox
  5020.  
  5021.     ' METHODS for object: AboutEnvelopForm.lstDLLs
  5022.     Sub Reset
  5023.       dim v, s as string
  5024.       dim pos as integer
  5025.       dim done as Boolean
  5026.       Clear
  5027.       v = ObjectModule.Version
  5028.       done = False
  5029.       While Not done
  5030.         pos = Instr(v, ";")
  5031.         If pos > 0 Then 
  5032.           s = Left(v, pos - 1)
  5033.           v = Mid(v, pos + 1)
  5034.         Else 
  5035.           s = v
  5036.           done = True
  5037.         End If
  5038.         pos = Instr(s, ":")
  5039.         AddItem Left(s, pos - 1) & " " & Mid(s, pos + 1)
  5040.       Wend
  5041.     End Sub
  5042.  
  5043.   End Type
  5044.   Dim MLReadMe As New MarkupLayer
  5045.   Dim MLRelNotes As New MarkupLayer
  5046.   Dim MLTrouble As New MarkupLayer
  5047.   Dim MLLicense As New MarkupLayer
  5048.   Dim MLRegister As New MarkupLayer
  5049.   Dim MLStory As New MarkupLayer
  5050.   Dim MLJoinUs As New MarkupLayer
  5051.   Dim MLOK As New MarkupLayer
  5052.   Dim MLVersion As New MarkupLayer
  5053.  
  5054.   ' METHODS for object: AboutEnvelopForm
  5055.   Sub Execute()
  5056.     LoadForm
  5057.     LayoutControls
  5058.     Center
  5059.     ShowModal
  5060.   End Sub
  5061.  
  5062.   Sub imgAbout_Click()
  5063.     Hide
  5064.   End Sub
  5065.  
  5066.   Sub KeyUp(keyCode As Integer, ByVal shift As Integer)
  5067.     Hide
  5068.   End Sub
  5069.  
  5070.   Sub LayoutControls
  5071.     Dim x, y, w, h, gap As Single
  5072.     ' Size the form so that it just fits the bitmap/image.
  5073.     ' Ensure that the image is not stretched.
  5074.     imgAbout.ResizeMode = "1 - Clip"
  5075.     imgAbout.ScaleX = 1.0
  5076.     imgAbout.ScaleY = 1.0
  5077.     imgAbout.ScrollBars = "0 - Never"
  5078.   
  5079.     ' Move image to upper-left and appropriate size for the bitmap
  5080.     ' while my ScaleMode is pixels.
  5081.     ScaleMode = "3 - Pixel"
  5082.     imgAbout.Move(0, 0, bitmap.Width, bitmap.Height)
  5083.   
  5084.     ' Markup layer positions are currently hard-coded in pixels.
  5085.     ' Change the lines below to =1 and uncomment to help lay them out manually.
  5086.     ' MLReadMe.BevelOuter = 0
  5087.     ' MLRelNotes.BevelOuter = 0
  5088.     ' MLTrouble.BevelOuter = 0
  5089.     ' MLLicense.BevelOuter = 0
  5090.     ' MLRegister.BevelOuter = 0
  5091.     ' MLStory.BevelOuter = 0
  5092.     ' MLJoinUs.BevelOuter = 0
  5093.     ' MLOK.BevelOuter = 0
  5094.     ' MLVersion.BevelOuter = 0
  5095.     x = 332 : y = 48 : w = 128 : h = 16 : gap = 5
  5096.     MLReadMe.Move(x, y, w, h) : y = y + h : MLReadMe.ZOrder = 1
  5097.     MLRelNotes.Move(x, y, w, h) : y = y + h : MLRelNotes.ZOrder = 2
  5098.     MLTrouble.Move(x, y, w, h) : y = y + h : MLTrouble.ZOrder = 3
  5099.     y = y + gap
  5100.     MLLicense.Move(x, y, w, h) : y = y + h : MLLicense.ZOrder = 4
  5101.     MLRegister.Move(x, y, w, h) : y = y + h : MLRegister.ZOrder = 5
  5102.     y = y + gap
  5103.     MLStory.Move(x, y, w, h) : y = y + h : MLStory.ZOrder = 6
  5104.     MLJoinUs.Move(x, y, w, h) : y = y + h : MLJoinUs.ZOrder = 7
  5105.     y = y + gap
  5106.     MLOK.Move(x, y, w, h) : y = y + h : MLOK.ZOrder = 8
  5107.     y = y + gap
  5108.     MLVersion.Move(x, y, w, h) : y = y + h : MLVersion.ZOrder = 9
  5109.   
  5110.     ' Position and hide the list of DLLs in pixel mode.
  5111.     x = 332 : y = 48 : w = 128 : h = 170
  5112.     lstDLLs.Move(x, y, w, h)
  5113.     lstDLLs.Visible = False
  5114.   
  5115.     ' Go to twips mode to size the form to the image.
  5116.     ScaleMode = "1 - Twip"
  5117.     BorderStyle = "0 - None"
  5118.     Width = imgAbout.Width
  5119.     Height = imgAbout.Height
  5120.     KeyPreview = True ' ensure I get keys to make hiding easy.
  5121.   End Sub
  5122.  
  5123.   Sub lstDLLs_DblClick()
  5124.     lstDLLs.Visible = False
  5125.   End Sub
  5126.  
  5127.   Sub MLJoinUs_Click()
  5128.     ShowFile("JOIN_US.TXT")
  5129.   End Sub
  5130.  
  5131.   Sub MLLicense_Click()
  5132.     ShowFile("LICENSE.TXT")
  5133.   End Sub
  5134.  
  5135.   Sub MLOK_Click()
  5136.     Hide
  5137.   End Sub
  5138.  
  5139.   Sub MLReadMe_Click()
  5140.     ShowFile("README.TXT")
  5141.   End Sub
  5142.  
  5143.   Sub MLRegister_Click()
  5144.     ShowFile("REGISTER.TXT")
  5145.   End Sub
  5146.  
  5147.   Sub MLRelNotes_Click()
  5148.     ShowFile("NOTES.TXT")
  5149.   End Sub
  5150.  
  5151.   Sub MLStory_Click()
  5152.     ShowFile("STORY.TXT")
  5153.   End Sub
  5154.  
  5155.   Sub MLTrouble_Click()
  5156.     ShowFile("TROUBLE.TXT")
  5157.   End Sub
  5158.  
  5159.   Sub MLVersion_Click()
  5160.     lstDLLs.Visible = True
  5161.     lstDLLs.ZOrder = 1
  5162.     lstDLLs.Reset
  5163.   End Sub
  5164.  
  5165.   Sub ShowFile(filename As String)
  5166.     Dim simple As New SimpleMultiLineDialog
  5167.     Dim F As New File
  5168.     F.FileName = Envelop.Path & filename
  5169.     simple.Width = Screen.Width * 0.75
  5170.     If simple.Width < 8000 Then simple.Width = Screen.Width
  5171.     simple.Height = Screen.Height * 0.75
  5172.     simple.Center
  5173.     simple.ExecuteFile(Envelop.Path & filename, True, True)
  5174.   End Sub
  5175.  
  5176. End Type
  5177.  
  5178. Type WorkSet From ObjectEditor
  5179.   Type WorkSetForm From Form
  5180.     Dim List As New ListBox
  5181.     Dim ListMaxItems As Integer
  5182.     Dim IgnoreClick As Integer
  5183.  
  5184.     ' METHODS for object: WorkSet.WorkSetForm
  5185.     Sub CleanList()
  5186.       Dim i as integer
  5187.     
  5188.       i = 0
  5189.       While i < List.ListCount - 1
  5190.         If (Not FindObject(List.List(i))) Then 
  5191.           List.RemoveItem(i)
  5192.           EnvelopForm.CBSelectedObject.RemoveItem(i)
  5193.         Else 
  5194.           i = i + 1
  5195.         End If
  5196.       Wend
  5197.     End Sub
  5198.  
  5199.     Sub Edit(obj as Object)
  5200.       dim name as String
  5201.       dim grpObj as Object
  5202.       dim idx as Long
  5203.     
  5204.       LoadForm
  5205.       If Not obj Then 
  5206.         Exit Sub
  5207.       End If
  5208.     
  5209.       ' Remove item if already in list
  5210.       name = obj
  5211.       idx = FindPosition(name)
  5212.       If (idx <> -1) Then 
  5213.         List.RemoveItem(idx)
  5214.       End If
  5215.     
  5216.       ' Shorten list if it is too long.
  5217.       If (ListMaxItems = List.ListCount) Then 
  5218.         List.RemoveItem(List.ListCount - 1)
  5219.       End If
  5220.     
  5221.       ' Add item in and suppress click method
  5222.       List.InsertItem(name, 0)
  5223.       If List.ListIndex Then 
  5224.         IgnoreClick = True
  5225.         List.ListIndex = 0
  5226.       End If
  5227.     
  5228.       ' Propagate selection to CBSelectedObject
  5229.       EnvelopForm.CBSelectedObject.Edit obj
  5230.     End Sub
  5231.  
  5232.     Function FindPosition(ObjName as String) As Integer
  5233.       FindPosition = List.ItemIndex(ObjName)
  5234.     End Function
  5235.  
  5236.     Sub List_Click()
  5237.       If IgnoreClick Then 
  5238.         IgnoreClick = False
  5239.       Else 
  5240.         Dim obj as Object
  5241.         obj = FindObject(List.Text)
  5242.         CleanList
  5243.         If obj Then 
  5244.           ' Special case the EnvelopForm to turn Form-Editing off (avoids confusing state)
  5245.           If (obj = EnvelopForm) Then FormEditor.Editing = False
  5246.           ObjectEditorMgr.ResetOthers(WorkSet, obj)
  5247.           ObjectEditorMgr.Selection obj
  5248.         End If
  5249.       End If
  5250.     End Sub
  5251.  
  5252.     Sub List_DblClick()
  5253.       Dim obj as Object
  5254.       obj = FindObject(List.Text)
  5255.       CleanList
  5256.       If obj Then 
  5257.         ' Special case the EnvelopForm to turn Form-Editing off (avoids confusing state)
  5258.         If (obj = EnvelopForm) Then FormEditor.Editing = False
  5259.         ObjectEditorMgr.Edit(obj)
  5260.         EnvelopForm.CBSelectedObject.Edit obj
  5261.       End If
  5262.     End Sub
  5263.  
  5264.     Sub List_DragStart(data as XferData, x As Single, y As Single)
  5265.       dim o as Object
  5266.       o = FindObject(List.Text)
  5267.       If o Then 
  5268.         data.ObjectRef = o
  5269.         data.Drag(1)
  5270.       End If
  5271.     End Sub
  5272.  
  5273.     Sub List_KeyDown(keyCode As Integer, ByVal shift As Integer)
  5274.       If (keyCode = VK_F1) Then Envelop.Help.ShowTopicHelp("WorkSet")
  5275.     End Sub
  5276.  
  5277.     Sub NextObj()
  5278.       If List.ListIndex = 0 Then 
  5279.         List.ListIndex = List.ListCount - 1
  5280.       Else 
  5281.         List.ListIndex = List.ListIndex - 1
  5282.       End If
  5283.     End Sub
  5284.  
  5285.     Sub PrevObj()
  5286.       If List.ListIndex = List.ListCount - 1 Then 
  5287.         List.ListIndex = 0
  5288.       Else 
  5289.         List.ListIndex = List.ListIndex + 1
  5290.       End If
  5291.     End Sub
  5292.  
  5293.     Sub Resize()
  5294.       List.Move(0, 0, ScaleWidth, ScaleHeight)
  5295.       Height = Height - ScaleHeight + List.Height
  5296.     End Sub
  5297.  
  5298.   End Type
  5299.   Property Visible Get getVisible Set setVisible As Boolean
  5300.  
  5301.   ' METHODS for object: WorkSet
  5302.   Function Active() as Integer
  5303.     Active = WorkSetForm.List.ListCount > 1
  5304.   End Function
  5305.  
  5306.   Sub BringToTop()
  5307.     WorkSetForm.BringToTop()
  5308.   End Sub
  5309.  
  5310.   Sub CleanList
  5311.     WorkSetForm.CleanList
  5312.   End Sub
  5313.  
  5314.   Sub Edit(obj As Object)
  5315.     WorkSetForm.Edit(obj)
  5316.   End Sub
  5317.  
  5318.   Function getVisible() as Boolean
  5319.     getVisible = WorkSetForm.Visible
  5320.   End Function
  5321.  
  5322.   Sub Hide()
  5323.     WorkSetForm.Hide()
  5324.   End Sub
  5325.  
  5326.   Sub NextObj()
  5327.     WorkSetForm.NextObj()
  5328.   End Sub
  5329.  
  5330.   Sub PrevObj()
  5331.     WorkSetForm.PrevObj()
  5332.   End Sub
  5333.  
  5334.   Sub Selection(obj as Object)
  5335.     ' Propagate selection to CBSelectedObject
  5336.     EnvelopForm.CBSelectedObject.Selection obj
  5337.   End Sub
  5338.  
  5339.   Sub setVisible(vis as Boolean)
  5340.     WorkSetForm.Visible = vis
  5341.   End Sub
  5342.  
  5343.   Sub Show()
  5344.     WorkSetForm.Show()
  5345.   End Sub
  5346.  
  5347.   Function TextUnload(ByVal indent As String, cmds As String) As Integer
  5348.     ' Save Nothing
  5349.     TextUnload = True
  5350.   End Function
  5351.  
  5352. End Type
  5353.  
  5354. Type ObjectBoxConfigWizard From WizardMaster.Wizard
  5355.   Type ObjBoxMargin From WizardMaster.FrmStep
  5356.     Dim TBTop As New TextBox
  5357.     Dim TBLeft As New TextBox
  5358.     Dim TBRight As New TextBox
  5359.     Dim TBBottom As New TextBox
  5360.     Dim LBLTop As New Label
  5361.     Dim LBLLeft As New Label
  5362.     Dim LBLRight As New Label
  5363.     Dim LBLBottom As New Label
  5364.   End Type
  5365.   Type ObjBoxLayout From WizardMaster.FrmStep
  5366.     Dim OBToolBar As New OptionButton
  5367.     Dim OBToolBox As New OptionButton
  5368.  
  5369.     ' METHODS for object: ObjectBoxConfigWizard.ObjBoxLayout
  5370.     Sub ObjBoxLayout_ValidateDisplay(ok As Boolean)
  5371.       If TempBox.LayoutStyle = "ToolBox" Then 
  5372.         ObjBoxLayout.OBToolBar.Value = False
  5373.         ObjBoxLayout.OBToolBox.Value = True
  5374.       Else 
  5375.         ObjBoxLayout.OBToolBox.Value = False
  5376.         ObjBoxLayout.OBToolBar.Value = True
  5377.       End If
  5378.     End Sub
  5379.  
  5380.   End Type
  5381.   Type ObjBoxTileDir From WizardMaster.FrmStep
  5382.     Dim OBHoriz As New OptionButton
  5383.     Dim OBVertical As New OptionButton
  5384.  
  5385.     ' METHODS for object: ObjectBoxConfigWizard.ObjBoxTileDir
  5386.     Sub OBHoriz_Click()
  5387.       wizard.TempBox.TileDirection = "Horizontal"
  5388.     End Sub
  5389.  
  5390.     Sub OBVertical_Click()
  5391.       wizard.TempBox.TileDirection = "Vertical"
  5392.     End Sub
  5393.  
  5394.   End Type
  5395.   Type ObjBoxColumns From WizardMaster.FrmStep
  5396.     Dim SBColumns As New ScrollBar
  5397.     Dim LblColumns As New Label
  5398.  
  5399.     ' METHODS for object: ObjectBoxConfigWizard.ObjBoxColumns
  5400.     Sub SBColumns_Change()
  5401.       LblColumns.Caption = "Columns: " & SBColumns.Value
  5402.       wizard.TempBox.NumColumns = SBColumns.Value
  5403.     End Sub
  5404.  
  5405.     Sub SBColumns_Scroll()
  5406.       LblColumns.Caption = "Columns: " & SBColumns.Value
  5407.     End Sub
  5408.  
  5409.     Sub TBColumns_KeyDown(keyCode As Integer, ByVal shift As Integer)
  5410.       Try
  5411.         If TBColumns.Text > SBColumns.Max Then 
  5412.           SBColumns.Max = TBColumns.Text
  5413.         Else 
  5414.           SBColumns.Max = 20
  5415.         End If
  5416.         SBColumns.Value = TBColumns.Text
  5417.       Catch
  5418.       End Try
  5419.     End Sub
  5420.  
  5421.   End Type
  5422.   Dim OriginalBox As ObjectBox
  5423.   Dim TempBox As New ObjectBox
  5424.  
  5425.   ' METHODS for object: ObjectBoxConfigWizard
  5426.   Sub FinishBox
  5427.     OriginalBox.MarginBottom = TempBox.MarginBottom
  5428.     OriginalBox.MarginLeft = TempBox.MarginLeft
  5429.     OriginalBox.MarginRight = TempBox.MarginRight
  5430.     OriginalBox.MarginTop = TempBox.MarginTop
  5431.     OriginalBox.LayoutStyle = TempBox.LayoutStyle
  5432.     OriginalBox.NumColumns = TempBox.NumColumns
  5433.     OriginalBox.TileDirection = TempBox.TileDirection
  5434.     OriginalBox.ForceLayout(True)
  5435.   End Sub
  5436.  
  5437.   Sub ObjBoxColumns_ValidateDisplay(ok As Boolean)
  5438.     ObjBoxColumns.SBColumns.Value = TempBox.NumColumns
  5439.   
  5440.   End Sub
  5441.  
  5442.   Sub ObjBoxColumns_ValidateFinish(ok As Boolean)
  5443.     FinishBox
  5444.   End Sub
  5445.  
  5446.   Sub ObjBoxLayout_ValidateDisplay(ok As Boolean)
  5447.     If TempBox.LayoutStyle = "ToolBox" Then 
  5448.       ObjBoxLayout.OBToolBar.Value = False
  5449.       ObjBoxLayout.OBToolBox.Value = True
  5450.     Else 
  5451.       ObjBoxLayout.OBToolBox.Value = False
  5452.       ObjBoxLayout.OBToolBar.Value = True
  5453.     End If
  5454.   
  5455.   End Sub
  5456.  
  5457.   Sub ObjBoxLayout_ValidateFinish(ok As Boolean)
  5458.     dim OKToFinish as Boolean
  5459.     ObjBoxLayout_ValidateNext(OKToFinish)
  5460.     If OKToFinish Then FinishBox
  5461.   End Sub
  5462.  
  5463.   Sub ObjBoxLayout_ValidateNext(ok As Boolean)
  5464.     If ObjBoxLayout.OBToolBar.Value Then 
  5465.       ObjBoxLayout.NextStep = ObjBoxTileDir
  5466.       TempBox.LayoutStyle = "ToolBar"
  5467.     Else 
  5468.       ObjBoxLayout.NextStep = ObjBoxColumns
  5469.       TempBox.LayoutStyle = "ToolBox"
  5470.     End If
  5471.     ok = True
  5472.   End Sub
  5473.  
  5474.   Sub ObjBoxMargin_ValidateDisplay(ok As Boolean)
  5475.     If OriginalBox = Nothing Then 
  5476.       MessageBox.Msg("Error in ObjectBoxConfigWizard, OriginalBox not connected")
  5477.       ok = False
  5478.     Else 
  5479.       If Not ObjBoxMargin.initialized Then 
  5480.         TempBox.MarginBottom = OriginalBox.MarginBottom
  5481.         TempBox.MarginLeft = OriginalBox.MarginLeft
  5482.         TempBox.MarginRight = OriginalBox.MarginRight
  5483.         TempBox.MarginTop = OriginalBox.MarginTop
  5484.         TempBox.LayoutStyle = OriginalBox.LayoutStyle
  5485.         TempBox.NumColumns = OriginalBox.NumColumns
  5486.         TempBox.TileDirection = OriginalBox.TileDirection
  5487.         ObjBoxMargin.initialized = True
  5488.       End If
  5489.       ObjBoxMargin.TBLeft.Text = TempBox.MarginLeft
  5490.       ObjBoxMargin.TBTop.Text = TempBox.MarginTop
  5491.       ObjBoxMargin.TBRight.Text = TempBox.MarginRight
  5492.       ObjBoxMargin.TBBottom.Text = TempBox.MarginBottom
  5493.     End If
  5494.   End Sub
  5495.  
  5496.   Sub ObjBoxMargin_ValidateFinish(ok As Boolean)
  5497.     dim OKToFinish as boolean
  5498.     ObjBoxMargin_ValidateNext(OKToFinish)
  5499.     If OKToFinish Then FinishBox
  5500.   End Sub
  5501.  
  5502.   Sub ObjBoxMargin_ValidateNext(ok As Boolean)
  5503.     Try
  5504.       TempBox.MarginLeft = ObjBoxMargin.TBLeft.Text
  5505.       TempBox.MarginTop = ObjBoxMargin.TBTop.Text
  5506.       TempBox.MarginRight = ObjBoxMargin.TBRight.Text
  5507.       TempBox.MarginBottom = ObjBoxMargin.TBBottom.Text
  5508.       ok = True
  5509.     Catch ConvertFailed
  5510.       MessageBox.Msg("Margins must be of type integer, please remove any non-numeric chars.")
  5511.       ok = False
  5512.     Catch
  5513.       MessageBox.Msg("Unexpected Behavior")
  5514.       ok = False
  5515.     End Try
  5516.   End Sub
  5517.  
  5518.   Sub ObjBoxTileDir_ValidateDisplay(ok As Boolean)
  5519.     If TempBox.TileDirection = "Horizontal" Then 
  5520.       ObjBoxTileDir.OBVertical.Value = False
  5521.       ObjBoxTileDir.OBHoriz.Value = True
  5522.     Else 
  5523.       ObjBoxTileDir.OBHoriz.Value = False
  5524.       ObjBoxTileDir.OBVertical.Value = True
  5525.     End If
  5526.   End Sub
  5527.  
  5528.   Sub ObjBoxTileDir_ValidateFinish(ok As Boolean)
  5529.     FinishBox
  5530.   End Sub
  5531.  
  5532.   Function TextUnload(ByVal indent As String, cmds As String) As Integer
  5533.     ' Write our parent's properties, but none of ours.
  5534.     TextUnload = False
  5535.   End Function
  5536.  
  5537. End Type
  5538.  
  5539. Type SampleMasterFormMenuBar From MenuBar
  5540. End Type
  5541.  
  5542. Type SampleMasterForm From Form
  5543.   Dim SampleDir As String
  5544.   Dim helpfile As New HelpFile
  5545.   Dim SampleName As String
  5546.  
  5547.   ' METHODS for object: SampleMasterForm
  5548.   Sub Destruct()
  5549.     helpfile.Quit
  5550.   End Sub
  5551.  
  5552.   Sub ExitApplication_Click()
  5553.     helpfile.Quit
  5554.     Hide
  5555.   End Sub
  5556.  
  5557.   Sub HelpContents_Click()
  5558.     helpfile.Contents
  5559.   End Sub
  5560.  
  5561.   Function HelpContents_Enable() As Integer
  5562.     HelpContents_Enable = helpfile.Exists
  5563.   End Function
  5564.  
  5565.   Sub InitHelpFile
  5566.     helpfile.FileName = SampleDir & SampleName & ".hlp"
  5567.   End Sub
  5568.  
  5569.   Sub Preload
  5570.     SetSampleDir
  5571.     InitHelpFile
  5572.     If Me <> SampleMasterForm Then LoadForm
  5573.     ResetApplication_Click
  5574.     If Me <> SampleMasterForm Then Show
  5575.   End Sub
  5576.  
  5577.   Sub ResetApplication_Click()
  5578.   End Sub
  5579.  
  5580.   Sub SaveAsBinary
  5581.     ModuleManager.ModuleContaining(Me).SaveAs(SampleDir & SampleName & ".ebo", False)
  5582.   End Sub
  5583.  
  5584.   Sub SaveAsText
  5585.     ModuleManager.ModuleContaining(Me).SaveAs(SampleDir & SampleName & ".eto", True)
  5586.   End Sub
  5587.  
  5588.   Sub SetSampleDir()
  5589.     ' The purpose of this routine is to set "SampleDir", a string containing
  5590.     ' the directory from which the application was loaded.  This may be useful
  5591.     ' in the event any data must be saved from the application and File objects
  5592.     ' were used and possibly changed our current directory.
  5593.     Dim m As ObjectModule
  5594.     Dim f As New File
  5595.     m = ModuleManager.ModuleContaining(Me)
  5596.     f.FileName = m.FileName
  5597.     SampleDir = f.Path
  5598.     SampleName = f.Name
  5599.   End Sub
  5600.  
  5601.   Sub TextPreLoad()
  5602.     ' Ensures the call to Load.
  5603.     RequestObjectPreload(Me)
  5604.   
  5605.     ' Restore prerequisite objects that are shared with other
  5606.     ' samples, and therefore may already be loaded.
  5607.   End Sub
  5608.  
  5609. End Type
  5610.  
  5611. Type FormEditor From FormEditor
  5612.  
  5613.   ' METHODS for object: FormEditor
  5614.   Function DblClick(item As Object, shift As Integer, x As Single, y As Single) As Integer
  5615.     ' If its a form, and SHIFT or CTRL is pressed ...
  5616.     If item && TypeOf item Is Form && shift Then 
  5617.       ' If we are already editing the double-clicked form, edit parent, if it
  5618.       ' is not the EnvelopForm. Otherwise, call det
  5619.       If (CurForm = item) Then 
  5620.         If item.Parent && (item.Parent <> EnvelopForm) Then CurForm = item.Parent
  5621.       Else 
  5622.         CurForm = item
  5623.       End If
  5624.     Else 
  5625.       ' Detailed edit for non forms...
  5626.       If ObjectEditorMgr.DetailedEdit(item) Then 
  5627.         ' A specialized ObjectEditor handled the event.
  5628.         PropertyEditor.Refresh("ChangedProperty")
  5629.       Else 
  5630.         ' DblClick on an object with no special DetailedEdit, gets a free trip
  5631.         ' to the MethodEditor
  5632.         MethodEditor.BringToTop
  5633.       End If
  5634.     End If
  5635.   End Function
  5636.  
  5637.   Sub KeyUp(keyCode As Integer, ByVal shift As Integer)
  5638.     If (keyCode = VK_F1) Then 
  5639.       If NumSelected Then 
  5640.         Envelop.Help.ShowObjectHelp(GetSelected(0))
  5641.       Else 
  5642.         Envelop.Help.ShowTopicHelp("Form_environment")
  5643.       End If
  5644.     ElseIf (keyCode = VK_DELETE) Then 
  5645.       EnvelopForm.DeleteObject_Click()
  5646.     End If
  5647.   End Sub
  5648.  
  5649. End Type
  5650.  
  5651. Type SampleMasterFormFileMenu From PopupMenu
  5652. End Type
  5653.  
  5654. Type Debugger From Debugger
  5655. End Type
  5656.  
  5657. Type MenuEdit From Form
  5658.   Type menuList From IndentedList
  5659.     Dim bitmaps As New Bitmap
  5660.   End Type
  5661.   Dim ICN_CLOSEDFOLDER As Integer
  5662.   Dim ICN_OPENFOLDER As Integer
  5663.   Dim ICN_MENUITEM As Integer
  5664.   Dim ICN_SEPARATOR As Integer
  5665.   Dim DraggingIndex As Long
  5666.   Dim InputMenu As Menu
  5667.   Dim WorkingMenu As Menu
  5668.   Type menutools From ObjectBox
  5669.     Dim openmenu As New ToolGadget
  5670.     Dim testdrive As New ToolGadget
  5671.     Dim apply As New ToolGadget
  5672.     Dim insertitem As New ToolGadget
  5673.     Dim insertsubmenu As New ToolGadget
  5674.     Dim insertsep As New ToolGadget
  5675.     Dim delitem As New ToolGadget
  5676.     Dim moveup As New ToolGadget
  5677.     Dim movedown As New ToolGadget
  5678.     Dim properties As New ToolGadget
  5679.   End Type
  5680.   Dim Label1 As New Label
  5681.   Dim Label2 As New Label
  5682.   Dim txtCaption As New TextBox
  5683.   Dim txtName As New TextBox
  5684.   Dim Label3 As New Label
  5685.   Dim chkChecked As New CheckBox
  5686.   Dim cbAccel As New ComboBox
  5687.   Dim UpdatingProperties As Integer
  5688.   Dim SuppressUpdatingProperties As Integer
  5689.  
  5690.   ' METHODS for object: MenuEdit
  5691.   Function AllowSepAtIndex(ByVal index As Integer) As Integer
  5692.     Dim theMenu As Object
  5693.     Dim level As Integer
  5694.     Dim position As Integer
  5695.   
  5696.     If index = -1 Then 
  5697.       AllowSepAtIndex = False
  5698.     ElseIf MenuEdit.menuList.ItemLevel(index) > 1 Then 
  5699.       AllowSepAtIndex = True
  5700.     Else  ' see if we are directly beneath a menu bar
  5701.       ' Only bother checking further if the top guy is a menubar
  5702.       theMenu = MenuEdit.menuList.ItemObject(0)
  5703.       If TypeOf theMenu Is FindObject("MenuBar") Then 
  5704.         If index = 0 Then 
  5705.           AllowSepAtIndex = False
  5706.         Else 
  5707.           theMenu = MenuEdit.menuList.ItemObject(index)
  5708.           ' Submenu    ---check to see if folder is open or closed
  5709.           If theMenu Then 
  5710.             If MenuEdit.menuList.ItemIsExpanded(index) Then 
  5711.               ' If folder is open, we'll allow inserting seps
  5712.               AllowSepAtIndex = True
  5713.             Else 
  5714.               ' special check in case
  5715.               ' we have an empty folder....alway insertion
  5716.               If theMenu.ItemCount = 0 Then 
  5717.                 AllowSepAtIndex = True
  5718.               Else 
  5719.                 AllowSepAtIndex = False
  5720.               End If
  5721.             End If
  5722.           Else  ' Must be command item, disallow sep insertion
  5723.             AllowSepAtIndex = False
  5724.           End If
  5725.         End If
  5726.       Else  ' not beneath menubar
  5727.         AllowSepAtIndex = True
  5728.       End If
  5729.     End If
  5730.   End Function
  5731.  
  5732.   Sub apply_Click
  5733.     CloneMenuRecursively(InputMenu, WorkingMenu)
  5734.   End Sub
  5735.  
  5736.   Function apply_Enable As Integer
  5737.     apply_Enable = IIf(MenuEdit.menuList.ListCount > 0, True, False)
  5738.   End Function
  5739.  
  5740.   Sub cbAccel_Click()
  5741.     Dim index As Integer
  5742.     Dim position As Integer
  5743.     Dim accelKey As Long
  5744.     Dim theMenu As Object
  5745.     Dim name As String
  5746.   
  5747.     If UpdatingProperties Then Exit Sub
  5748.   
  5749.     index = MenuEdit.menuList.ListIndex
  5750.   
  5751.     ' Get out if nothing is selected or it at the anchor
  5752.     If index <= 0 Then Exit Sub
  5753.   
  5754.     ' get the containing menu for the item at index where we st
  5755.     ' the item's relative position within that containing menu
  5756.     theMenu = GetPositionInfo(index, position)
  5757.   
  5758.     name = theMenu.ItemNameAt(position)
  5759.   
  5760.     accelKey = cbAccel.ListIndex
  5761.     If accelKey <> -1 Then 
  5762.       theMenu.AccelKey = accelKey
  5763.       theMenu.SetAccelerator(name, accelKey)
  5764.     End If
  5765.   End Sub
  5766.  
  5767.   Sub chkChecked_Click()
  5768.     Dim index As Integer
  5769.     Dim position As Integer
  5770.     Dim theMenu As Object
  5771.     Dim name As String
  5772.   
  5773.     If UpdatingProperties Then Exit Sub
  5774.   
  5775.     index = MenuEdit.menuList.ListIndex
  5776.   
  5777.     ' Get out if nothing is selected or it at the anchor
  5778.     If index <= 0 Then Exit Sub
  5779.   
  5780.     ' get the containing menu for the item at index where we st
  5781.     ' the item's relative position within that containing menu
  5782.     theMenu = GetPositionInfo(index, position)
  5783.   
  5784.     name = theMenu.ItemNameAt(position)
  5785.     theMenu.CheckItem(name, chkChecked.Value)
  5786.   End Sub
  5787.  
  5788.   Sub CleanUp
  5789.     DestroyObject(MenuTester.MenuBar)
  5790.     MenuEdit.menuList.Clear
  5791.   End Sub
  5792.  
  5793.   Sub CloneMenuRecursively(destMenu As Object, sourceMenu As Object)
  5794.     Dim i As Integer
  5795.     Dim itemId As Long
  5796.     Dim subMenu As Object
  5797.     Dim newMenu As Object
  5798.     Dim name As String
  5799.     Dim pos As Integer
  5800.     Dim checked As Integer
  5801.     Dim accelKey As Long
  5802.   
  5803.     ' Gut the destination menu.  Peel 'em off from the tail on up
  5804.     For i = destMenu.ItemCount - 1 To 0 Step -1
  5805.       destMenu.RemoveItem(i)
  5806.     Next i
  5807.   
  5808.     ' go through the source menu and rebuild the dest menu
  5809.     ' from it
  5810.     For i = 0 To sourceMenu.ItemCount - 1
  5811.   
  5812.       itemId = sourceMenu.ItemIdAt(i)
  5813.   
  5814.       name = sourceMenu.ItemNameAt(i)
  5815.   
  5816.       ' If the item is a submenu (id == -1), process it as well
  5817.       If (itemId = -1) Then 
  5818.         subMenu = FindObject(name)
  5819.   
  5820.         If Not HostObject(subMenu) Then 
  5821.           ' for submenus that are coming from top level popups (re-usable menus)
  5822.           ' prefix their names with 'REFD'
  5823.           name = "REFD" & name
  5824.         Else 
  5825.           ' Get at the 'local' name
  5826.           pos = Instr(2, name, ".")
  5827.           While pos
  5828.             name = Right$(name, Len(name) - pos)
  5829.             pos = Instr(2, name, ".")
  5830.           Wend
  5831.         End If
  5832.   
  5833.         ' When doing the cloning that is applying changes to our input menu, and
  5834.         ' we have a submenu prefaced with REFD (indicating a top level reusable
  5835.         ' popup) we want to apply the changes to that popup at the top level
  5836.         ' and not embed the menu.
  5837.         If Left$(name, 4) = "REFD" Then 
  5838.           newMenu = FindObject(Right$(name, Len(name) - 4))
  5839.           If Not HostObject(newMenu) Then 
  5840.             ' insert that popup into the dest menu
  5841.             destMenu.InsertPopup(newMenu, sourceMenu.ItemCaptionAt(i), i)
  5842.             CloneMenuRecursively(newMenu, subMenu)
  5843.           End If
  5844.         Else 
  5845.           ' See if there is already a menu there with the same name
  5846.           newMenu = FindEmbed(destMenu, name)
  5847.           ' if not, embed a fresh one
  5848.           If Not newMenu Then 
  5849.             newMenu = EmbedObject(destMenu, FindObject("PopupMenu"), name)
  5850.           End If
  5851.   
  5852.           ' insert that popup into the dest menu
  5853.           destMenu.InsertPopup(newMenu, sourceMenu.ItemCaptionAt(i), i)
  5854.   
  5855.           ' and recursively clone the submenu into the new embed
  5856.           CloneMenuRecursively(newMenu, subMenu)
  5857.         End If
  5858.       Else 
  5859.   
  5860.         ' Looks like we'll have to use GetMenuState to determine if
  5861.         ' we have a separator...for now, just see if the name
  5862.         ' is blank
  5863.         If (name = "") Then 
  5864.           destMenu.InsertSeparator(i)
  5865.         Else 
  5866.           destMenu.InsertItem(name, sourceMenu.ItemCaptionAt(i), i)
  5867.   
  5868.           checked = IIf(sourceMenu.ItemIsChecked(name), 1, 0)
  5869.           destMenu.CheckItem(name, checked)
  5870.   
  5871.           accelKey = sourceMenu.GetAccelerator(name)
  5872.           If accelKey <> -1 Then 
  5873.             destMenu.AccelKey = accelKey
  5874.             destMenu.SetAccelerator(name, accelKey)
  5875.           End If
  5876.         End If
  5877.   
  5878.       End If
  5879.   
  5880.     Next i
  5881.   
  5882.   End Sub
  5883.  
  5884.   Sub close_Click
  5885.     CleanUp
  5886.     MenuEdit.Hide
  5887.     MenuTester.Hide
  5888.   End Sub
  5889.  
  5890.   Sub DeleteListEntries(ByVal index As Integer, ByVal level As Integer)
  5891.     Dim l As Integer
  5892.   
  5893.     MenuEdit.menuList.RemoveItem(index)
  5894.   
  5895.     ' Note that after we removed the item, the next item in the list
  5896.     ' is now at position 'index', so we do not need to increment
  5897.     ' index
  5898.   
  5899.     l = MenuEdit.menuList.ItemLevel(index)
  5900.     While index < MenuEdit.menuList.ListCount && l > level
  5901.       MenuEdit.menuList.RemoveItem(index)
  5902.   
  5903.       l = MenuEdit.menuList.ItemLevel(index)
  5904.     Wend
  5905.   End Sub
  5906.  
  5907.   Sub delitem_Click
  5908.     RemoveCurrentItem
  5909.   End Sub
  5910.  
  5911.   Function delitem_Enable As Integer
  5912.     delitem_Enable = IIf(MenuEdit.menuList.ListIndex > 0, True, False)
  5913.   End Function
  5914.  
  5915.   Function FindNextSameLevelIndex(ByVal index As Integer) As Integer
  5916.     ' get the index for the first item after to us that has the same level as ours
  5917.     Dim l, level As Integer
  5918.     Dim count As Integer
  5919.     Dim returnIndex As Integer
  5920.   
  5921.     level = MenuEdit.menuList.ItemLevel(index)
  5922.     count = MenuEdit.menuList.ListCount
  5923.   
  5924.     returnIndex = index + 1
  5925.     l = MenuEdit.menuList.ItemLevel(returnIndex)
  5926.   
  5927.     ' go forward in the list until we hit a guy with a
  5928.     ' level the same as ours
  5929.   
  5930.     While l <> level && returnIndex < count
  5931.       returnIndex = returnIndex + 1
  5932.       l = MenuEdit.menuList.ItemLevel(returnIndex)
  5933.     Wend
  5934.     FindNextSameLevelIndex = returnIndex
  5935.   End Function
  5936.  
  5937.   Function FindPrevLevelIndex(ByVal index As Integer) As Integer
  5938.     ' get the index for the first item prior to us that has a level less than ours
  5939.     Dim l, level As Integer
  5940.     Dim returnIndex As Integer
  5941.   
  5942.     level = MenuEdit.menuList.ItemLevel(index)
  5943.   
  5944.     returnIndex = index - 1
  5945.     l = MenuEdit.menuList.ItemLevel(returnIndex)
  5946.   
  5947.     ' go backward in the list until we hit a guy with a
  5948.     ' level less than our own
  5949.     While l >= level && returnIndex >= 0
  5950.       returnIndex = returnIndex - 1
  5951.       l = MenuEdit.menuList.ItemLevel(returnIndex)
  5952.     Wend
  5953.     FindPrevLevelIndex = returnIndex
  5954.   End Function
  5955.  
  5956.   Function FindPrevSameLevelIndex(ByVal index As Integer) As Integer
  5957.     ' get the index for the first item prior to us that has the same level as ours
  5958.     Dim l, level As Integer
  5959.     Dim returnIndex As Integer
  5960.   
  5961.     level = MenuEdit.menuList.ItemLevel(index)
  5962.   
  5963.     returnIndex = index - 1
  5964.     l = MenuEdit.menuList.ItemLevel(returnIndex)
  5965.   
  5966.     ' go backward in the list until we hit a guy with a
  5967.     ' level the same as ours
  5968.     While l <> level && returnIndex > 0
  5969.       returnIndex = returnIndex - 1
  5970.       l = MenuEdit.menuList.ItemLevel(returnIndex)
  5971.     Wend
  5972.     FindPrevSameLevelIndex = returnIndex
  5973.   End Function
  5974.  
  5975.   Function  GetPositionInfo(ByVal index As Integer, relativePosition As Integer) As Object
  5976.     Dim l, level As Integer
  5977.   
  5978.     ' get the containing menu for the item at the current index and
  5979.     ' the item's relative position within that containing menu
  5980.   
  5981.     relativePosition = 0
  5982.   
  5983.     level = MenuEdit.menuList.ItemLevel(index)
  5984.   
  5985.     index = index - 1
  5986.     l = MenuEdit.menuList.ItemLevel(index)
  5987.   
  5988.     ' go backward in the list until we hit a guy with a
  5989.     ' level less than our own
  5990.     While l >= level && index >= 0
  5991.       ' only increment the relativePosition counter when we
  5992.       ' have encountered an entry at the same level
  5993.       If l = level Then relativePosition = relativePosition + 1
  5994.       index = index - 1
  5995.       l = MenuEdit.menuList.ItemLevel(index)
  5996.     Wend
  5997.   
  5998.     GetPositionInfo = MenuEdit.menuList.ItemObject(index)
  5999.   End Function
  6000.  
  6001.   Sub InsertItem(label As String, name As String, checked As Integer, accelKey As Long)
  6002.     Dim index As Integer
  6003.     Dim level As Integer
  6004.     Dim position As Integer
  6005.     Dim intoSubMenu As Boolean
  6006.     Dim theMenu As Object
  6007.   
  6008.     theMenu = PrepForInsertion(index, level, position)
  6009.   
  6010.     If index = -1 Then Exit Sub
  6011.   
  6012.     If theMenu Then 
  6013.       ' add it to the menu
  6014.       theMenu.InsertItem(name, label, position)
  6015.   
  6016.       ' only do check & accels if we are within a popup
  6017.       If TypeOf theMenu Is FindObject("PopupMenu") Then 
  6018.         ' check it if need be
  6019.         If checked Then theMenu.CheckItem(name, 1)
  6020.   
  6021.         ' deal with any acclerator key
  6022.         If accelKey <> -1 Then 
  6023.           theMenu.AccelKey = accelKey
  6024.           theMenu.SetAccelerator(name, accelKey)
  6025.         End If
  6026.       End If
  6027.   
  6028.       ' add it to our list
  6029.       MenuEdit.menuList.InsertItem(label, ICN_MENUITEM, level, index + 1)
  6030.       MenuEdit.menuList.SetSelected(index + 1, True)
  6031.       UpdateProperties
  6032.     End If
  6033.   
  6034.   End Sub
  6035.  
  6036.   Sub insertitem_Click
  6037.     InsertItem("Item", "Item", 0, 0)
  6038.   End Sub
  6039.  
  6040.   Function insertitem_Enable As Integer
  6041.     insertitem_Enable = IIf(MenuEdit.menuList.ListIndex <> -1, True, False)
  6042.   End Function
  6043.  
  6044.   Sub InsertSeparator
  6045.     Dim index As Integer
  6046.     Dim level As Integer
  6047.     Dim position As Integer
  6048.     Dim intoSubMenu As Boolean
  6049.     Dim theMenu As Object
  6050.   
  6051.     theMenu = PrepForInsertion(index, level, position)
  6052.   
  6053.     If index = -1 Then Exit Sub
  6054.   
  6055.     If theMenu && TypeOf theMenu Is FindObject("PopupMenu") Then 
  6056.       ' add it to the menu
  6057.       theMenu.InsertSeparator(position)
  6058.   
  6059.       ' add it to our list
  6060.       MenuEdit.menuList.InsertItem("<separator>", ICN_SEPARATOR, level, index + 1)
  6061.       MenuEdit.menuList.SetSelected(index + 1, True)
  6062.       UpdateProperties
  6063.     End If
  6064.   
  6065.   
  6066.   End Sub
  6067.  
  6068.   Sub insertsep_Click
  6069.     InsertSeparator
  6070.   End Sub
  6071.  
  6072.   Function insertsep_Enable As Integer
  6073.     insertsep_Enable = AllowSepAtIndex(MenuEdit.menuList.ListIndex)
  6074.   End Function
  6075.  
  6076.   Sub InsertSubMenu(label As String, name As String)
  6077.     Dim index As Integer
  6078.     Dim level As Integer
  6079.     Dim position As Integer
  6080.     Dim theMenu As Object
  6081.     Dim newMenu As PopupMenu
  6082.   
  6083.     theMenu = PrepForInsertion(index, level, position)
  6084.   
  6085.     If index = -1 Then Exit Sub
  6086.   
  6087.     If theMenu Then 
  6088.       ' create a new popup and add it to the menu
  6089.       newMenu = EmbedObject(theMenu, FindObject("PopupMenu"), name)
  6090.       theMenu.InsertPopup(newMenu, label, position)
  6091.   
  6092.   
  6093.       index = index + 1
  6094.       ' add it to our list
  6095.       MenuEdit.menuList.InsertItem(label, ICN_CLOSEDFOLDER, level, index)
  6096.   
  6097.       ' Indicate that this guy can expand & close
  6098.       MenuEdit.menuList.SetItemCanExpand(index, True)
  6099.   
  6100.       MenuEdit.menuList.SetItemObject(index, newMenu)
  6101.   
  6102.       MenuEdit.menuList.SetSelected(index, True)
  6103.   
  6104.       UpdateProperties
  6105.     End If
  6106.   
  6107.   End Sub
  6108.  
  6109.   Sub insertsubmenu_Click
  6110.     Dim retVal As Long
  6111.     Dim index As Integer
  6112.     Dim level As Integer
  6113.     Dim position As Integer
  6114.     Dim theMenu As Object
  6115.   
  6116.     theMenu = PrepForInsertion(index, level, position)
  6117.   
  6118.     ' Get a name for the Submenu
  6119.     retVal = InputDialog.Execute("Insert Submenu", "Enter a name for the submenu", UniqueEmbedName(theMenu, "Submenu"))
  6120.   
  6121.     If retVal = IDOK Then 
  6122.       InsertSubMenu("Submenu", InputDialog.Text)
  6123.     End If
  6124.   End Sub
  6125.  
  6126.   Function insertsubmenu_Enable As Integer
  6127.     insertsubmenu_Enable = IIf(MenuEdit.menuList.ListIndex <> -1, True, False)
  6128.   End Function
  6129.  
  6130.   Sub menuList_Click()
  6131.     UpdateProperties
  6132.   End Sub
  6133.  
  6134.   Sub menuList_Collapsed(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj as Object)
  6135.     MenuEdit.menuList.SetItemIcon(itemIndex, ICN_CLOSEDFOLDER)
  6136.     UpdateProperties
  6137.   End Sub
  6138.  
  6139.   Sub menuList_DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  6140.     Dim targetIndex As Integer
  6141.     Dim dragLevel As Integer
  6142.     Dim position As Integer
  6143.     Dim i As Integer
  6144.     Dim ok As Boolean
  6145.   
  6146.     Dim dragIsFolder As Boolean
  6147.     Dim theMenu as Object
  6148.     Dim dragMenu As Object
  6149.   
  6150.     ' get the index of the list item under the cursor
  6151.     targetIndex = menuList.FindIndexUnderPoint(x, y)
  6152.   
  6153.     ' get out if we have an invalid target index or
  6154.     ' we're dropping a guy onto himself or trying to drag the 'anchor'
  6155.     If targetIndex = -1 || targetIndex = DraggingIndex || DraggingIndex = 0 Then 
  6156.       ' show the No Drop cursor
  6157.       If state = 2 Then effect = 0
  6158.       Exit Sub
  6159.     End If
  6160.   
  6161.   
  6162.     ' see if we are dragging a folder
  6163.     dragMenu = MenuEdit.menuList.ItemObject(DraggingIndex)
  6164.     If dragMenu Then 
  6165.       dragIsFolder = True
  6166.     Else 
  6167.       ' See if we are dragging a separator and if the target index should
  6168.       ' allow a drop (to prevent seps under menubars)
  6169.       ' Only need to bother if target index is <=1 ...minor optimization
  6170.       If MenuEdit.menuList.ItemLevel(targetIndex) <= 1 Then 
  6171.         theMenu = GetPositionInfo(DraggingIndex, position)
  6172.         If theMenu.ItemNameAt(position) = "" && Not AllowSepAtIndex(targetIndex) Then 
  6173.           ' show the No Drop cursor
  6174.           If state = 2 Then effect = 0
  6175.           Exit Sub
  6176.         End If
  6177.       End If
  6178.     End If
  6179.   
  6180.     dragLevel = MenuEdit.menuList.ItemLevel(DraggingIndex)
  6181.   
  6182.     If dragIsFolder Then 
  6183.       ' Must make sure we are not dragging a menu into one of its own descendants
  6184.       If targetIndex > DraggingIndex Then 
  6185.         If MenuEdit.menuList.ItemLevel(DraggingIndex + 1) > dragLevel Then 
  6186.           ok = False
  6187.           For i = DraggingIndex + 1 To targetIndex
  6188.             If MenuEdit.menuList.ItemLevel(i) <= dragLevel Then 
  6189.               ok = True
  6190.               Exit For
  6191.             End If
  6192.           Next i
  6193.           If Not ok Then 
  6194.             ' show the No Drop cursor
  6195.             If state = 2 Then effect = 0
  6196.             Exit Sub
  6197.           End If
  6198.         End If
  6199.       End If
  6200.     End If
  6201.   
  6202.     ' beyond this point, we're not currently interested unless we are dropping
  6203.     If state = 3 Then RelocateItem(DraggingIndex, targetIndex, False)
  6204.   
  6205.   End Sub
  6206.  
  6207.   Sub menuList_DragStart(xfd As XferData, x As Single, y As Single)
  6208.     DraggingIndex = menuList.FindIndexUnderPoint(x, y)
  6209.     MenuEdit.menuList.SetSelected(DraggingIndex, True)
  6210.     UpdateProperties
  6211.     xfd.Drag(2)
  6212.     ' Drag and drop ends up eating the mouse up event.  Since we
  6213.     ' are doing left mouse dnd, this leaves the list in a state where it
  6214.     ' is expecting a mouse up.  The side effect is that the list tracks
  6215.     ' the cursor to highlight the selection (while the mouse is up).
  6216.     ' We will explicitly send a lbutton up message to the list's hwnd
  6217.     ' to fix the problem.
  6218.     SendMessage(menuList.hWnd, User32.WM_LBUTTONUP, 0, 0)
  6219.   End Sub
  6220.  
  6221.   Sub menuList_Expand(ByVal itemIndex as Integer, ByVal itemData as Long, itemObj as Object)
  6222.     Dim index As Integer
  6223.     Dim level As Integer
  6224.     Dim theMenu As Object
  6225.   
  6226.     ' display the 'expanded' icon
  6227.     MenuEdit.menuList.SetItemIcon(itemIndex, ICN_OPENFOLDER)
  6228.   
  6229.     ' Try to find the menu we want in the
  6230.     ' ItemObject of the list entry
  6231.   
  6232.     theMenu = MenuEdit.menuList.ItemObject(itemIndex)
  6233.   
  6234.     If Not theMenu Then Exit Sub
  6235.   
  6236.     level = MenuEdit.menuList.ItemLevel(itemIndex)
  6237.   
  6238.     index = itemIndex + 1
  6239.     level = level + 1
  6240.     ProcessMenusRecursively(theMenu, False, level, index)
  6241.   
  6242.     UpdateProperties
  6243.   
  6244.   End Sub
  6245.  
  6246.   Sub menuList_KeyDown(keyCode As Integer, ByVal shift As Integer)
  6247.     If (keyCode = VK_DELETE) Then 
  6248.       RemoveCurrentItem
  6249.     End If
  6250.   End Sub
  6251.  
  6252.   Sub movedown_Click
  6253.     Dim index As Integer
  6254.     Dim level As Integer
  6255.     Dim level2 As Integer
  6256.     Dim pos As Integer
  6257.   
  6258.     index = MenuEdit.menuList.ListIndex
  6259.   
  6260.   
  6261.     ' Get out if nothing is selected or if dealing with the Anchor
  6262.     If index <= 0 Then Exit Sub
  6263.   
  6264.     If index + 1 >= MenuEdit.menuList.ListCount Then Exit Sub
  6265.   
  6266.   
  6267.     level = MenuEdit.menuList.ItemLevel(index)
  6268.     level2 = MenuEdit.menuList.ItemLevel(index + 1)
  6269.   
  6270.     If level2 < level Then Exit Sub
  6271.   
  6272.   
  6273.     If level2 <> level Then 
  6274.       pos = FindNextSameLevelIndex(index)
  6275.       If MenuEdit.menuList.ItemIsExpanded(pos) Then pos = FindNextSameLevelIndex(pos) - 1
  6276.       RelocateItem(index, pos, True)
  6277.     ElseIf MenuEdit.menuList.ItemIsExpanded(index + 1) Then 
  6278.       pos = FindNextSameLevelIndex(index + 1) - 1
  6279.       RelocateItem(index, pos, True)
  6280.     Else 
  6281.       RelocateItem(index, index + 1, True)
  6282.     End If
  6283.   
  6284.   End Sub
  6285.  
  6286.   Function movedown_Enable As Integer
  6287.     Dim retVal As Integer
  6288.     Dim index As Integer
  6289.     Dim level As Integer
  6290.     Dim level2 As Integer
  6291.   
  6292.     retVal = False
  6293.   
  6294.     index = MenuEdit.menuList.ListIndex
  6295.   
  6296.     If index > 0 && index + 1 < MenuEdit.menuList.ListCount Then 
  6297.   
  6298.       level = MenuEdit.menuList.ItemLevel(index)
  6299.       level2 = MenuEdit.menuList.ItemLevel(index + 1)
  6300.   
  6301.       If level2 >= level Then retVal = True
  6302.   
  6303.     End If
  6304.   
  6305.     movedown_Enable = retVal
  6306.   End Function
  6307.  
  6308.   Sub moveup_Click
  6309.     Dim index As Integer
  6310.     Dim level As Integer
  6311.     Dim level2 As Integer
  6312.   
  6313.     index = MenuEdit.menuList.ListIndex
  6314.   
  6315.   
  6316.     ' Get out if nothing is selected or if dealing with the Anchor
  6317.     If index <= 0 Then Exit Sub
  6318.   
  6319.   
  6320.     level = MenuEdit.menuList.ItemLevel(index)
  6321.     level2 = MenuEdit.menuList.ItemLevel(index - 1)
  6322.   
  6323.     If level - 1 = level2 Then Exit Sub
  6324.   
  6325.     If level2 <> level Then 
  6326.       RelocateItem(index, FindPrevSameLevelIndex(index) - 1, True)
  6327.     Else 
  6328.       ' use index -2 because it represent the spot after which
  6329.       ' the moved item is placed
  6330.       RelocateItem(index, index - 2, True)
  6331.     End If
  6332.   
  6333.   End Sub
  6334.  
  6335.   Function moveup_Enable As Integer
  6336.     Dim retVal As Integer
  6337.     Dim index As Integer
  6338.     Dim level As Integer
  6339.     Dim level2 As Integer
  6340.   
  6341.     retVal = False
  6342.   
  6343.     index = MenuEdit.menuList.ListIndex
  6344.   
  6345.     If index > 0 Then 
  6346.   
  6347.   
  6348.       level = MenuEdit.menuList.ItemLevel(index)
  6349.       level2 = MenuEdit.menuList.ItemLevel(index - 1)
  6350.   
  6351.       If level - 1 <> level2 Then retVal = True
  6352.     End If
  6353.   
  6354.     moveup_Enable = retVal
  6355.   End Function
  6356.  
  6357.   Sub openmenu_Click
  6358.     Dim retVal As Long
  6359.   
  6360.     MenuSelector.optMbar.Value = True
  6361.     MenuSelector.Populate
  6362.   
  6363.     retVal = MenuSelector.ShowModal
  6364.     If retVal = IDOK Then 
  6365.       ProcessMenu(FindObject(MenuSelector.cboMenus.Text))
  6366.     End If
  6367.   End Sub
  6368.  
  6369.   Sub Preload()
  6370.     Dim enums As String
  6371.     dim curpos as Integer
  6372.   
  6373.     LoadForm
  6374.   
  6375.     ' build up the contents of the accelerator key combo box
  6376.     enums = GetEnumStrings("AcceleratorKey")
  6377.     cbAccel.Clear
  6378.     curpos = 1
  6379.     While (curpos < Len(enums))
  6380.       Dim eol as Integer
  6381.       eol = Instr(curpos, enums, Chr(13))
  6382.       If eol = 0 Then Exit Do
  6383.       cbAccel.AddItem(Mid(enums, curpos, (eol - curpos)))
  6384.       curpos = eol + 2
  6385.     Wend
  6386.   
  6387.     ' disable the property guys initially
  6388.     txtCaption.Enabled = False
  6389.     txtName.Enabled = False
  6390.     chkChecked.Enabled = False
  6391.     cbAccel.Enabled = False
  6392.   
  6393.   End Sub
  6394.  
  6395.   Function PrepForInsertion(index As Integer, level As Integer, position As Integer) As Object
  6396.     Dim index As Integer
  6397.     Dim level As Integer
  6398.     Dim intoSubMenu As Boolean
  6399.     Dim theMenu As Object
  6400.   
  6401.     ' This will retrieve the index, level, position, and containing menu in
  6402.     ' preparation for a menu insertion
  6403.     index = MenuEdit.menuList.ListIndex
  6404.     If index = -1 Then Exit Function
  6405.   
  6406.     ' deal with case for root object...always expand
  6407.     If index = 0 Then 
  6408.       theMenu = MenuEdit.menuList.ItemObject(index)
  6409.       MenuEdit.menuList.ExpandItem(0)
  6410.       position = 0
  6411.       level = 1
  6412.       PrepForInsertion = theMenu
  6413.       Exit Function
  6414.     End If
  6415.   
  6416.   
  6417.     theMenu = MenuEdit.menuList.ItemObject(index)
  6418.     level = MenuEdit.menuList.ItemLevel(index)
  6419.   
  6420.     intoSubMenu = False
  6421.   
  6422.   
  6423.     ' Submenu    ---check to see if folder is open or closed
  6424.     If theMenu Then 
  6425.       If MenuEdit.menuList.ItemIsExpanded(index) Then 
  6426.         ' If folder is open, we'll insert at the top of the menu
  6427.         level = level + 1
  6428.         intoSubMenu = True
  6429.       Else 
  6430.         ' special check in case
  6431.         ' we have an empty folder....alway add the
  6432.         ' new node to the empty folder (because empty folders will never
  6433.         ' let ItemIsExpanded return True
  6434.         If theMenu.ItemCount = 0 Then 
  6435.           level = level + 1
  6436.           intoSubMenu = True
  6437.           MenuEdit.menuList.SetItemIcon(index, ICN_OPENFOLDER)
  6438.         End If
  6439.   
  6440.       End If
  6441.   
  6442.     End If
  6443.   
  6444.     If intoSubMenu Then 
  6445.       position = 0
  6446.     Else 
  6447.       ' get the containing menu for the item at the current index and
  6448.       ' the item's relative position within that containing menu
  6449.       theMenu = GetPositionInfo(index, position)
  6450.       position = position + 1
  6451.     End If
  6452.   
  6453.     PrepForInsertion = theMenu
  6454.   
  6455.   End Function
  6456.  
  6457.   Sub ProcessMenu(theMenu As Object)
  6458.     Dim m As Object
  6459.     Dim stdMbar As MenuBar
  6460.     Dim index As Integer
  6461.     Dim name As String
  6462.   
  6463.     CleanUp
  6464.   
  6465.     If Not theMenu Then Exit Sub
  6466.   
  6467.     ' the reset is to get the icons drawn cuz
  6468.     ' when we are using an eto file, they don't show up
  6469.     MenuEdit.menuList.Reset
  6470.   
  6471.     name = theMenu
  6472.   
  6473.     ' get the menubar proto
  6474.     stdMbar = FindObject("MenuBar")
  6475.   
  6476.     If TypeOf theMenu Is stdMbar Then 
  6477.       ' if we're dealing with a menubar, embed the menubar proto onto
  6478.       ' the testing form and then clone the input meubar into it
  6479.       ' EmbedObject(MenuTester, stdMbar, "TestingMenuBar")
  6480.       ' CloneMenu(MenuTester.TestingMenuBar, theMenu, False)
  6481.       EmbedObject(MenuTester, theMenu, "TestingMenuBar")
  6482.       SubsumeRecursively(MenuTester.TestingMenuBar)
  6483.   
  6484.       MenuTester.MenuBar = MenuTester.TestingMenuBar
  6485.       WorkingMenu = MenuTester.TestingMenuBar
  6486.     ElseIf TypeOf theMenu Is FindObject("PopupMenu") Then 
  6487.       ' if we we're dealing with a pop-up, first embed the
  6488.       ' standard menubar into our test form
  6489.       EmbedObject(MenuTester, stdMbar, "TestingMenuBar")
  6490.       MenuTester.MenuBar = MenuTester.TestingMenuBar
  6491.   
  6492.       ' then embed a standard popupmenu into the menubar and
  6493.       ' clone the input menu into it
  6494.       ' EmbedObject(MenuTester.TestingMenuBar, FindObject("PopupMenu"), "TestingMenu")
  6495.       ' CloneMenu(MenuTester.TestingMenuBar.TestingMenu, theMenu, False)
  6496.   
  6497.       EmbedObject(MenuTester.TestingMenuBar, theMenu, "TestingMenu")
  6498.       SubsumeRecursively(MenuTester.TestingMenuBar.TestingMenu)
  6499.   
  6500.       WorkingMenu = MenuTester.TestingMenuBar.TestingMenu
  6501.       MenuTester.MenuBar.InsertPopup(WorkingMenu, name, 0)
  6502.     Else 
  6503.       Exit Sub
  6504.     End If
  6505.   
  6506.     InputMenu = theMenu
  6507.   
  6508.     ' construct the list based upon info in the test menubar
  6509.     index = 0
  6510.   
  6511.     ' Set the title bar of the menu editor
  6512.     MenuEdit.Caption = "Editing:  " & name
  6513.   
  6514.     ' add the 'anchor' for our list
  6515.     MenuEdit.menuList.InsertItem(name, ICN_OPENFOLDER, 0, index)
  6516.   
  6517.     ' Set the list item's object to be the test menu
  6518.     MenuEdit.menuList.SetItemObject(index, WorkingMenu)
  6519.   
  6520.     ' Indicate that this guy can expand & close
  6521.     MenuEdit.menuList.SetItemCanExpand(index, True)
  6522.   
  6523.     index = index + 1
  6524.   
  6525.     ProcessMenusRecursively(WorkingMenu, False, 1, index)
  6526.   
  6527.   End Sub
  6528.  
  6529.   Sub ProcessMenusRecursively(theMenu As Object, ByVal expandSubMenus As Boolean, ByVal level As Integer, index As Integer)
  6530.     Dim i As Integer
  6531.     Dim iconVal As Integer
  6532.     Dim itemId As Long
  6533.     Dim subMenu As Object
  6534.     Dim newMenu As Object
  6535.     Dim name As String
  6536.     Dim caption As String
  6537.     ' TODO Make sure theMenu is MenuBar or PopupMenu
  6538.   
  6539.     If theMenu Then 
  6540.       For i = 0 To theMenu.ItemCount - 1
  6541.   
  6542.         itemId = theMenu.ItemIdAt(i)
  6543.   
  6544.         name = theMenu.ItemNameAt(i)
  6545.   
  6546.         caption = theMenu.ItemCaptionAt(i)
  6547.   
  6548.   
  6549.         ' If the item is a submenu (id == -1), process it as well
  6550.         If (itemId = -1) Then 
  6551.   
  6552.   
  6553.           subMenu = FindObject(name)
  6554.   
  6555.           If Not HostObject(subMenu) Then 
  6556.             ' for submenus that are coming from top level popups (re-usable menus)
  6557.             ' prefix their names with 'REFD'
  6558.             name = "REFD" & name
  6559.   
  6560.             ' remove the menu item that referred to the reusable menu
  6561.             theMenu.RemoveItem(i)
  6562.   
  6563.             ' get a fresh embed to represent the ref'd menu
  6564.             newMenu = EmbedObject(theMenu, FindObject("PopupMenu"), name)
  6565.   
  6566.             ' clone the original ref'd submenu into our new embed
  6567.             CloneMenuRecursively(newMenu, subMenu)
  6568.   
  6569.             ' insert into the same spot
  6570.             theMenu.InsertPopup(newMenu, caption, i)
  6571.   
  6572.             subMenu = newMenu
  6573.   
  6574.           End If
  6575.   
  6576.           If expandSubMenus Then 
  6577.             iconVal = ICN_OPENFOLDER
  6578.           Else 
  6579.             iconVal = ICN_CLOSEDFOLDER
  6580.           End If
  6581.   
  6582.           MenuEdit.menuList.InsertItem(caption, iconVal, level, index)
  6583.   
  6584.           ' Set the list item's object to be the submenu
  6585.           MenuEdit.menuList.SetItemObject(index, subMenu)
  6586.   
  6587.           ' Indicate that this guy can expand & close
  6588.           MenuEdit.menuList.SetItemCanExpand(index, True)
  6589.   
  6590.           index = index + 1
  6591.   
  6592.           ' Process the submenu
  6593.           If expandSubMenus Then ProcessMenusRecursively(subMenu, expandSubMenus, level + 1, index)
  6594.         Else 
  6595.   
  6596.           ' Looks like we'll have to use GetMenuState to determine if
  6597.           ' we have a separator...for now, just see if the name
  6598.           ' is blank
  6599.           If (name = "") Then 
  6600.             MenuEdit.menuList.InsertItem("<separator>", ICN_SEPARATOR, level, index)
  6601.             index = index + 1
  6602.           Else 
  6603.             MenuEdit.menuList.InsertItem(caption, ICN_MENUITEM, level, index)
  6604.             index = index + 1
  6605.           End If
  6606.   
  6607.         End If
  6608.   
  6609.       Next i
  6610.     End If
  6611.   
  6612.   
  6613.   End Sub
  6614.  
  6615.   Sub properties_Click
  6616.     Dim vis As Boolean
  6617.   
  6618.     If menutools.properties.State = 1 Then 
  6619.       menutools.properties.State = 0
  6620.       ' Turn off all the property stuff
  6621.       vis = False
  6622.     Else 
  6623.       menutools.properties.State = 1
  6624.       vis = True
  6625.     End If
  6626.   
  6627.     ' Turn all the property stuff on or off
  6628.     Label1.Visible = vis
  6629.     Label2.Visible = vis
  6630.     Label3.Visible = vis
  6631.     txtCaption.Visible = vis
  6632.     txtName.Visible = vis
  6633.     chkChecked.Visible = vis
  6634.     cbAccel.Visible = vis
  6635.   
  6636.     ' resize the menuList
  6637.     Resize
  6638.   End Sub
  6639.  
  6640.   Sub RelocateItem(ByVal originalIndex As Integer, ByVal targetIndex As Integer, ByVal preserveLevel As Boolean)
  6641.     Dim originalLevel As Integer
  6642.     Dim targetLevel As Integer
  6643.     Dim originalContainer As Object
  6644.     Dim targetContainer As Object
  6645.     Dim originalPosition As Integer
  6646.     Dim targetPosition As Integer
  6647.     Dim i As Integer
  6648.     Dim ok As Boolean
  6649.   
  6650.     Dim iconVal As Integer
  6651.   
  6652.     Dim targetIsFolder As Boolean
  6653.     Dim originalIsFolder As Boolean
  6654.     Dim targetIsOpen As Boolean
  6655.     Dim targetMenu as Object
  6656.     Dim originalMenu As Object
  6657.     Dim copiedMenu As Object
  6658.   
  6659.     Dim newName As String
  6660.     Dim newCaption As String
  6661.     Dim checked As Boolean
  6662.     Dim accelKey As Long
  6663.   
  6664.     originalMenu = MenuEdit.menuList.ItemObject(originalIndex)
  6665.     If originalMenu Then originalIsFolder = True
  6666.   
  6667.     originalLevel = MenuEdit.menuList.ItemLevel(originalIndex)
  6668.   
  6669.     If originalIsFolder Then 
  6670.       ' Must make sure we are not relocating a menu into one of its own descendants
  6671.       If targetIndex > originalIndex Then 
  6672.         If MenuEdit.menuList.ItemLevel(originalIndex + 1) > originalLevel Then 
  6673.           ok = False
  6674.           For i = originalIndex + 1 To targetIndex
  6675.             If MenuEdit.menuList.ItemLevel(i) <= originalLevel Then 
  6676.               ok = True
  6677.               Exit For
  6678.             End If
  6679.           Next i
  6680.           If Not ok Then 
  6681.             Exit Sub
  6682.           End If
  6683.         End If
  6684.       End If
  6685.     End If
  6686.   
  6687.     If Not preserveLevel Then 
  6688.       targetMenu = MenuEdit.menuList.ItemObject(targetIndex)
  6689.       If targetMenu Then 
  6690.         targetIsFolder = True
  6691.         ' see if the folder is open...Note that if the folder is empty, we
  6692.         ' will say that it is open, since dropping on a closed folder
  6693.         ' that is empty will result in dropping INTO the folder
  6694.         If MenuEdit.menuList.ItemIsExpanded(targetIndex) Then 
  6695.           targetIsOpen = True
  6696.         ElseIf targetMenu.ItemCount = 0 Then 
  6697.           targetIsOpen = True
  6698.           MenuEdit.menuList.SetItemIcon(targetIndex, ICN_OPENFOLDER)
  6699.         End If
  6700.       End If
  6701.     End If
  6702.   
  6703.     ' get the containing menu for the item at the original index and
  6704.     ' the item's relative position within that containing menu
  6705.     originalContainer = GetPositionInfo(originalIndex, originalPosition)
  6706.   
  6707.     If Not preserveLevel Then 
  6708.       ' get the containing menu for the item at index where we are dropping and
  6709.       ' the item's relative position within that containing menu
  6710.       targetContainer = GetPositionInfo(targetIndex, targetPosition)
  6711.   
  6712.       targetLevel = MenuEdit.menuList.ItemLevel(targetIndex)
  6713.   
  6714.       targetIndex = targetIndex + 1
  6715.   
  6716.       If targetIsFolder && targetIsOpen Then 
  6717.         ' TARGET FOLDER IS OPEN --- ADD INTO IT
  6718.         targetContainer = targetMenu
  6719.         targetPosition = 0
  6720.         targetLevel = targetLevel + 1
  6721.       Else 
  6722.         targetPosition = targetPosition + 1
  6723.       End If
  6724.     Else 
  6725.       targetContainer = originalContainer
  6726.       targetLevel = originalLevel
  6727.       targetIndex = targetIndex + 1
  6728.   
  6729.       If targetIndex < originalIndex Then 
  6730.         targetPosition = originalPosition - 1
  6731.       Else 
  6732.         targetPosition = originalPosition + 2
  6733.       End If
  6734.     End If
  6735.   
  6736.     If originalIsFolder Then 
  6737.       Dim pos As Integer
  6738.       ' Extract info for the original guy
  6739.       newName = originalContainer.ItemNameAt(originalPosition)
  6740.   
  6741.       ' Get at the 'local' name
  6742.       pos = Instr(2, newName, ".")
  6743.       While pos
  6744.         newName = Right$(newName, Len(newName) - pos)
  6745.         pos = Instr(2, newName, ".")
  6746.       Wend
  6747.   
  6748.       newCaption = originalContainer.ItemCaptionAt(originalPosition)
  6749.       iconVal = ICN_CLOSEDFOLDER
  6750.   
  6751.       ' copiedMenu = EmbedObject(targetContainer, FindObject("PopupMenu"), "bldrTmp")
  6752.       ' CloneMenu(copiedMenu, originalMenu, False)
  6753.       copiedMenu = EmbedObject(targetContainer, originalMenu, "bldrTmp")
  6754.   
  6755.       SubsumeRecursively(copiedMenu)
  6756.   
  6757.       originalContainer.RemoveItem(originalPosition)
  6758.   
  6759.       ' If within the same container, compensate for the guy we deleted if it was
  6760.       ' above the target position
  6761.       If originalContainer = targetContainer Then 
  6762.         If originalPosition < targetPosition Then targetPosition = targetPosition - 1
  6763.       End If
  6764.   
  6765.       targetContainer.InsertPopup(copiedMenu, newCaption, targetPosition)
  6766.   
  6767.       DestroyObject(originalMenu)
  6768.       RenameObject(copiedMenu, newName)
  6769.   
  6770.       ' Get the list up to date.  Deal with lowest in the list first
  6771.       SuppressUpdatingProperties = 1
  6772.       If originalIndex >= targetIndex Then 
  6773.         MenuEdit.menuList.CollapseItem(originalIndex)
  6774.         MenuEdit.menuList.RemoveItem(originalIndex)
  6775.         MenuEdit.menuList.InsertItem(newCaption, iconVal, targetLevel, targetIndex)
  6776.   
  6777.         MenuEdit.menuList.SetItemCanExpand(targetIndex, True)
  6778.         MenuEdit.menuList.SetItemObject(targetIndex, copiedMenu)
  6779.         MenuEdit.menuList.SetSelected(targetIndex, True)
  6780.       Else 
  6781.         MenuEdit.menuList.InsertItem(newCaption, iconVal, targetLevel, targetIndex)
  6782.   
  6783.         MenuEdit.menuList.SetItemCanExpand(targetIndex, True)
  6784.         MenuEdit.menuList.SetItemObject(targetIndex, copiedMenu)
  6785.   
  6786.         If MenuEdit.menuList.ItemIsExpanded(originalIndex) Then 
  6787.           MenuEdit.menuList.CollapseItem(originalIndex)
  6788.         Else 
  6789.           MenuEdit.menuList.SetSelected(targetIndex - 1, True)
  6790.         End If
  6791.         MenuEdit.menuList.RemoveItem(originalIndex)
  6792.       End If
  6793.       SuppressUpdatingProperties = 0
  6794.   
  6795.     Else 
  6796.       ' DRAG IS COMMAND ITEM OR SEPARATOR
  6797.   
  6798.       ' extract info from the original guy
  6799.       newName = originalContainer.ItemNameAt(originalPosition)
  6800.   
  6801.       If newName <> "" Then 
  6802.         newCaption = originalContainer.ItemCaptionAt(originalPosition)
  6803.         If Not TypeOf originalContainer Is FindObject("MenuBar") Then 
  6804.           checked = originalContainer.ItemIsChecked(newName)
  6805.           accelKey = originalContainer.GetAccelerator(newName)
  6806.         End If
  6807.         iconVal = ICN_MENUITEM
  6808.       Else 
  6809.         newCaption = "<separator>"
  6810.         iconVal = ICN_SEPARATOR
  6811.       End If
  6812.   
  6813.       ' remove the original guy
  6814.       originalContainer.RemoveItem(originalPosition)
  6815.   
  6816.       ' If within the same container, compensate for the guy we deleted if it was
  6817.       ' above the target position
  6818.       If originalContainer = targetContainer Then 
  6819.         If originalPosition < targetPosition Then targetPosition = targetPosition - 1
  6820.       End If
  6821.   
  6822.       SuppressUpdatingProperties = 1
  6823.       If newName <> "" Then 
  6824.         targetContainer.InsertItem(newName, newCaption, targetPosition)
  6825.         If checked Then targetContainer.CheckItem(newName, checked)
  6826.         If accelKey Then 
  6827.           targetContainer.AccelKey = accelKey
  6828.           targetContainer.SetAccelerator(newName, accelKey)
  6829.         End If
  6830.       Else 
  6831.         targetContainer.InsertSeparator(targetPosition)
  6832.       End If
  6833.   
  6834.       ' Get the list up to date.  Deal with lowest in the list first
  6835.       If originalIndex >= targetIndex Then 
  6836.         MenuEdit.menuList.RemoveItem(originalIndex)
  6837.         MenuEdit.menuList.InsertItem(newCaption, iconVal, targetLevel, targetIndex)
  6838.         MenuEdit.menuList.SetSelected(targetIndex, True)
  6839.       Else 
  6840.         MenuEdit.menuList.InsertItem(newCaption, iconVal, targetLevel, targetIndex)
  6841.         MenuEdit.menuList.RemoveItem(originalIndex)
  6842.         MenuEdit.menuList.SetSelected(targetIndex - 1, True)
  6843.       End If
  6844.       SuppressUpdatingProperties = 0
  6845.     End If
  6846.   
  6847.   End Sub
  6848.  
  6849.   Sub RemoveCurrentItem
  6850.     Dim index As Integer
  6851.     Dim relativePosition As Integer
  6852.     Dim containingMenu As Object
  6853.     Dim theMenu As Object
  6854.   
  6855.     index = MenuEdit.menuList.ListIndex
  6856.   
  6857.     ' Get out if nothing is selected or if dealing with the Anchor
  6858.     If index <= 0 Then Exit Sub
  6859.     ' get the containing menu for the item at the current index and
  6860.     ' the item's relative position within that containing menu
  6861.     containingMenu = GetPositionInfo(index, relativePosition)
  6862.   
  6863.     If containingMenu Then containingMenu.RemoveItem(relativePosition)
  6864.   
  6865.     ' if we are not deleting a 're-usable' referenced menu, destroy any
  6866.     ' object held by the list item (only applies to submenu entries)
  6867.     theMenu = MenuEdit.menuList.ItemObject(index)
  6868.     If theMenu Then 
  6869.       Dim name As String
  6870.       name = theMenu
  6871.       If Left$(name, 4) <> "REFD" Then DestroyObject(theMenu)
  6872.     End If
  6873.   
  6874.   
  6875.     ' delete the list entry and any sub menu items it may have
  6876.     DeleteListEntries(index, MenuEdit.menuList.ItemLevel(index))
  6877.  
  6878.     If (index < MenuEdit.menuList.ListCount) Then
  6879.       MenuEdit.menuList.SetSelected(index, True)
  6880.     Else
  6881.       MenuEdit.menuList.SetSelected(index-1, True)
  6882.     End If
  6883.  
  6884.   End Sub
  6885.  
  6886.   Sub Resize()
  6887.     menutools.Top = 0
  6888.     menutools.Left = 0
  6889.     menutools.Width = ScaleWidth
  6890.   
  6891.     ' keep the indented list snuggly within our form
  6892.     If Label2.Visible Then 
  6893.       menuList.Top = Label2.Top + Label2.Height
  6894.       menuList.Height = ScaleHeight - menuList.Top
  6895.     Else 
  6896.       menuList.Top = menutools.Height
  6897.       menuList.Height = ScaleHeight - menuList.Top
  6898.     End If
  6899.     menuList.Left = 0
  6900.     menuList.Width = ScaleWidth
  6901.   
  6902.   End Sub
  6903.  
  6904.   Sub SubsumeRecursively(theMenu As Object)
  6905.     ' TODO need to ensure that the menu is menubar or popup
  6906.     SubsumeParent(theMenu)
  6907.     EnumObjectEmbeds(theMenu, Me, "SubsumeRecursively")
  6908.   End Sub
  6909.  
  6910.   Sub testdrive_Click
  6911.     MenuTester.Show
  6912.     MenuTester.BringToTop
  6913.   End Sub
  6914.  
  6915.   Function testdrive_Enable As Integer
  6916.     testdrive_Enable = IIf(MenuEdit.menuList.ListCount > 0, True, False)
  6917.   End Function
  6918.  
  6919.   Sub txtCaption_KeyUp(keyCode As Integer, ByVal shift As Integer)
  6920.     Dim index As Integer
  6921.     Dim position As Integer
  6922.     Dim caption As String
  6923.     Dim theMenu As Object
  6924.   
  6925.     index = MenuEdit.menuList.ListIndex
  6926.   
  6927.     ' Get out if nothing is selected or it at the anchor
  6928.     If index <= 0 Then Exit Sub
  6929.   
  6930.     ' get the containing menu for the item at index where we st
  6931.     ' the item's relative position within that containing menu
  6932.     theMenu = GetPositionInfo(index, position)
  6933.   
  6934.     caption = txtCaption.Text
  6935.     theMenu.SetCaption(position, caption)
  6936.     MenuEdit.menuList.SetItemString(index, caption)
  6937.   End Sub
  6938.  
  6939.   Sub txtName_KeyUp(keyCode As Integer, ByVal shift As Integer)
  6940.     Dim index As Integer
  6941.     Dim position As Integer
  6942.     Dim theMenu As Object
  6943.   
  6944.     index = MenuEdit.menuList.ListIndex
  6945.   
  6946.     ' Get out if nothing is selected or it at the anchor
  6947.     If index <= 0 Then Exit Sub
  6948.   
  6949.     ' get the containing menu for the item at index where we st
  6950.     ' the item's relative position within that containing menu
  6951.     theMenu = GetPositionInfo(index, position)
  6952.   
  6953.     theMenu.SetName(position, txtName.Text)
  6954.   End Sub
  6955.  
  6956.   Sub UpdateProperties
  6957.     Dim index As Integer
  6958.     Dim position As Integer
  6959.     Dim name As String
  6960.     Dim caption As String
  6961.     Dim checked As Integer
  6962.     Dim accelKey As Long
  6963.     Dim theMenu As Object
  6964.     Dim pos As Integer
  6965.     Dim captionEnabled As Boolean
  6966.     Dim isCmdItem As Boolean
  6967.   
  6968.     If SuppressUpdatingProperties Then Exit Sub
  6969.   
  6970.     index = MenuEdit.menuList.ListIndex
  6971.   
  6972.     ' Get out if nothing is selected or it at the anchor
  6973.     If index <= 0 Then
  6974.       ' Clear out the properties.  use the UpdatingProperties flag
  6975.       ' to prevent combo box click method from redundantly
  6976.       ' doing work after we set the list index on it
  6977.       UpdatingProperties = 1
  6978.       txtCaption.Text = ""
  6979.       txtCaption.Enabled = False
  6980.       txtName.Text = ""
  6981.       txtName.Enabled = False
  6982.       chkChecked.Enabled = False
  6983.       cbAccel.Enabled = False
  6984.       chkChecked.Value = False
  6985.       cbAccel.ListIndex = 0
  6986.       UpdatingProperties = 0
  6987.  
  6988.       Exit Sub
  6989.     End If
  6990.   
  6991.     ' get the containing menu for the item at index where we started our drag and
  6992.     ' the item's relative position within that containing menu
  6993.     theMenu = GetPositionInfo(index, position)
  6994.   
  6995.     name = theMenu.ItemNameAt(position)
  6996.     caption = theMenu.ItemCaptionAt(position)
  6997.     captionEnabled = True
  6998.   
  6999.     If MenuEdit.menuList.ItemObject(index) Then 
  7000.       ' PropertiesForm.Caption = "SubMenu Item Properties"
  7001.       ' Get at the 'local' name
  7002.       pos = Instr(2, name, ".")
  7003.       While pos
  7004.         name = Right$(name, Len(name) - pos)
  7005.         pos = Instr(2, name, ".")
  7006.       Wend
  7007.     Else 
  7008.       ' PropertiesForm.Caption = "Command Item Properties"
  7009.       If name <> "" Then 
  7010.         If Not TypeOf theMenu Is FindObject("MenuBar") Then 
  7011.           checked = IIf(theMenu.ItemIsChecked(name), 1, 0)
  7012.           accelKey = theMenu.GetAccelerator(name)
  7013.         End If
  7014.         isCmdItem = True
  7015.       Else 
  7016.         caption = "<separator>"
  7017.         captionEnabled = False
  7018.       End If
  7019.     End If
  7020.   
  7021.     ' update the properties.  use the UpdatingProperties flag
  7022.     ' to prevent combo box click method from redundantly
  7023.     ' doing work after we set the list index on it
  7024.     UpdatingProperties = 1
  7025.     txtCaption.Text = caption
  7026.     txtCaption.Enabled = captionEnabled
  7027.     txtName.Text = name
  7028.     txtName.Enabled = isCmdItem
  7029.     chkChecked.Enabled = isCmdItem
  7030.     cbAccel.Enabled = isCmdItem
  7031.     chkChecked.Value = checked
  7032.     cbAccel.ListIndex = accelKey
  7033.     UpdatingProperties = 0
  7034.   
  7035.   End Sub
  7036.  
  7037. End Type
  7038.  
  7039. Type PropertyEditor From PropertyEditor
  7040.   Type DimensionArrayForm From Form
  7041.     Dim TBStmt As New TextBox
  7042.     Dim LblName As New Label
  7043.     Dim LblDims As New Label
  7044.     Dim CBType As New ComboBox
  7045.     Dim LblType As New Label
  7046.     Dim LblStmt As New Label
  7047.     Dim TBName As New TextBox
  7048.     Dim TBDims As New TextBox
  7049.     Dim posDim As Integer
  7050.     Dim posOpen As Integer
  7051.     Dim posName As Integer
  7052.     Dim posClose As Integer
  7053.     Dim posDims As Integer
  7054.     Dim posAs As Integer
  7055.     Dim posType As Integer
  7056.     Dim ignoreChange As Boolean
  7057.     Dim BtnOK As New Button
  7058.     Dim BtnCancel As New Button
  7059.  
  7060.     ' METHODS for object: PropertyEditor.DimensionArrayForm
  7061.     Sub BtnCancel_Click
  7062.       ModalResult IDCANCEL
  7063.     End Sub
  7064.  
  7065.     Sub BtnOK_Click
  7066.       ModalResult IDOK
  7067.     End Sub
  7068.  
  7069.     Sub CBType_Click()
  7070.       If Not ignoreChange Then 
  7071.         ParseStatement
  7072.         UpdateStatementType
  7073.       End If
  7074.     End Sub
  7075.  
  7076.     Function Execute(dimStmt As String) As Integer
  7077.       Dim initName As String
  7078.     
  7079.       ' Make sure the form is loaded so that Change events work
  7080.       LoadForm
  7081.       DefaultButton = BtnOK
  7082.       CancelButton = BtnCancel
  7083.     
  7084.       ' Initial value of dimStmt is a suggested name. If we have no
  7085.       ' prior statement, then use default, otherwise just set name.
  7086.       initName = IIf(dimStmt = "", "array", dimStmt)
  7087.       If TBStmt.Text = "" Then 
  7088.         TBStmt.Text = "Dim " & initName & " (10) As Integer"
  7089.       Else 
  7090.         TBName.Text = initName
  7091.       End If
  7092.     
  7093.       Show
  7094.       TBName.SetFocus : TBName.SelStart = 0 : TBName.SelLength = 256
  7095.       If ShowModal = IDOK Then 
  7096.         dimStmt = TBStmt.Text
  7097.         Execute = 1
  7098.       Else 
  7099.         Execute = -1
  7100.       End If
  7101.       Hide
  7102.     End Function
  7103.  
  7104.     Sub Load()
  7105.       CBType.AddItem "Integer"
  7106.       CBType.AddItem "Long"
  7107.       CBType.AddItem "String"
  7108.       CBType.AddItem "Single"
  7109.       CBType.AddItem "Double"
  7110.       CBType.AddItem "Object"
  7111.     End Sub
  7112.  
  7113.     Sub ParseStatement()
  7114.       Dim text As String
  7115.       text = TBStmt.Text
  7116.     
  7117.       posClose = 0 : posDims = 0 : posAs = 0 : posType = 0
  7118.     
  7119.       ' Look for 'dim' followed by '('.
  7120.       posDim = Instr(1, text, "dim", 1)
  7121.       posOpen = Instr(posDim + 1, text, "(")
  7122.       posName = IIf(posDim > 0, posDim + 3, 0)
  7123.     
  7124.       ' OK, now look for the ')' and, if found, get dimens part
  7125.       posClose = Instr(posOpen + 1, text, ")")
  7126.       posDims = IIf(posOpen > 0, posOpen + 1, 0)
  7127.     
  7128.       ' Look for 'as', followed by space: rest is the type
  7129.       posAs = Instr(posClose + 1, text, "as", 1)
  7130.       posType = IIf(posAs > 0, posAs + 2, 0)
  7131.     
  7132.     End Sub
  7133.  
  7134.     Sub Resize()
  7135.       Dim m, l, w, h, effWidth As Single
  7136.       m = TBStmt.Top
  7137.       w = BtnOK.Width : h = BtnOK.Height
  7138.       effWidth = IIf(ScaleWidth < 4470, 4470, ScaleWidth)
  7139.       l = effWidth - w - m
  7140.       BtnOK.Move(l, m, w, h)
  7141.       BtnCancel.Move(l, BtnOK.Top + h + m, w, h)
  7142.       w = BtnOK.Left - m - TBStmt.Left
  7143.       TBStmt.Width = w
  7144.       TBName.Width = w
  7145.       TBDims.Width = w
  7146.       ' CBType.Width = w
  7147.       Refresh
  7148.     End Sub
  7149.  
  7150.     Sub TBDims_Change()
  7151.       If Not ignoreChange Then 
  7152.         ParseStatement
  7153.         UpdateStatementDims
  7154.       End If
  7155.     End Sub
  7156.  
  7157.     Sub TBName_Change()
  7158.       If Not ignoreChange Then 
  7159.         ParseStatement
  7160.         UpdateStatementName
  7161.       End If
  7162.     End Sub
  7163.  
  7164.     Sub TBStmt_Change()
  7165.       If Not ignoreChange Then 
  7166.         ParseStatement
  7167.         UpdateNameDimType
  7168.       End If
  7169.     End Sub
  7170.  
  7171.     Sub UpdateNameDimType()
  7172.       Dim i As Integer
  7173.       Dim text, capType As String
  7174.       text = TBStmt.Text
  7175.     
  7176.       ' Update the name text if we can.
  7177.       ignoreChange = True
  7178.       If posDim = 0 || posOpen = 0 || Mid(text, posName, 1) <> " " Then 
  7179.         TBName.Text = ""
  7180.       Else 
  7181.         ' Trim the stuff between the dim and ( and call it the name.
  7182.         TBName.Text = Trim(Mid(text, posName, posOpen - posName))
  7183.       End If
  7184.     
  7185.       ' Dimens part is whatever is between the parens.
  7186.       If posOpen = 0 || posClose = 0 Then 
  7187.         TBDims.Text = ""
  7188.       Else 
  7189.         TBDims.Text = Trim(Mid(text, posDims, posClose - posDims))
  7190.       End If
  7191.     
  7192.       ' Type is whatever follows the 'as'
  7193.       If posAs = 0 || Mid(text, posType, 1) <> " " Then 
  7194.         CBType.ListIndex = -1
  7195.       Else 
  7196.         capType = Trim(Mid(text, posType))
  7197.         capType = UCase(Left(capType, 1)) & LCase(Mid(capType, 2))
  7198.         If capType = "" Then 
  7199.           CBType.ListIndex = -1
  7200.         Else 
  7201.           i = CBType.ItemIndex(capType)
  7202.           CBType.ListIndex = IIf(i <> -1, i, CBType.ListCount - 1)
  7203.         End If
  7204.       End If
  7205.       ignoreChange = False
  7206.     End Sub
  7207.  
  7208.     Sub UpdateStatementDims
  7209.       ' Replace dimens part (whatever is between the parens).
  7210.       If posOpen > 0 && posClose > 0 Then 
  7211.         Dim text As String
  7212.         text = TBStmt.Text
  7213.     
  7214.         ignoreChange = True
  7215.         TBStmt.Text = Left(text, posOpen) & TBDims.Text & Mid(text, posClose)
  7216.         ignoreChange = False
  7217.       End If
  7218.     End Sub
  7219.  
  7220.     Sub UpdateStatementName
  7221.       Dim text As String
  7222.       text = TBStmt.Text
  7223.     
  7224.       ' Replace the stuff between the dim and ( with the name
  7225.       If posDim > 0 && posOpen > 0 && Mid(text, posName, 1) = " " Then 
  7226.         ignoreChange = True
  7227.         TBStmt.Text = Left(text, posName) & TBName.Text & " " & Mid(text, posOpen)
  7228.         ignoreChange = False
  7229.       End If
  7230.     End Sub
  7231.  
  7232.     Sub UpdateStatementType
  7233.       Dim text As String
  7234.       text = TBStmt.Text
  7235.     
  7236.       ' Replace type in statement (whatever follows the 'as')
  7237.       If posAs > 0 && Mid(text, posType, 1) = " " Then 
  7238.         ignoreChange = True
  7239.         TBStmt.Text = Left(text, posType) & CBType.Text
  7240.         ignoreChange = False
  7241.       End If
  7242.     End Sub
  7243.  
  7244.   End Type
  7245.   Type EnumPicker From Form
  7246.     Dim EnumList As New ListBox
  7247.     Dim BtnOk As New Button
  7248.     Dim BtnCancel As New Button
  7249.  
  7250.     ' METHODS for object: PropertyEditor.EnumPicker
  7251.     Sub BtnCancel_Click()
  7252.       Hide : ModalResult(IDCANCEL)
  7253.     End Sub
  7254.  
  7255.     Sub BtnOk_Click()
  7256.       Hide : ModalResult(IDOK)
  7257.     End Sub
  7258.  
  7259.     Function ShowModal() As Long
  7260.       dim f strictly As Form
  7261.       dim enums As String
  7262.       dim curpos, eol as integer
  7263.     
  7264.       ' Make sure Form is created and shown, so configurations below stick.
  7265.       LoadForm()
  7266.       Show()
  7267.     
  7268.       EnumList.SetFocus()
  7269.     
  7270.       curpos = 1
  7271.       enums = GetEnumList()
  7272.       EnumList.Clear
  7273.       While (curpos < Len(enums))
  7274.         dim eol as integer
  7275.         eol = Instr(curpos, enums, Chr(13))
  7276.         If eol = 0 Then Exit Do
  7277.         EnumList.AddItem(Mid(enums, curpos, (eol - curpos)))
  7278.         curpos = eol + 2
  7279.       Wend
  7280.     
  7281.       f = Me
  7282.       ShowModal = f.ShowModal
  7283.     End Function
  7284.  
  7285.   End Type
  7286.   Type ObjPicker From Form
  7287.     Dim BtnOk As New Button
  7288.     Dim BtnCancel As New Button
  7289.     Dim ObjList As New ObjectList
  7290.     Dim Label1 As New Label
  7291.     Dim CBReference As New CheckBox
  7292.     Dim CBUntyped As New CheckBox
  7293.     Dim CBShowEmbeds As New CheckBox
  7294.  
  7295.     ' METHODS for object: PropertyEditor.ObjPicker
  7296.     Sub BtnCancel_Click()
  7297.       Hide : ModalResult(IDCANCEL)
  7298.     End Sub
  7299.  
  7300.     Sub BtnOk_Click()
  7301.       Hide : ModalResult(IDOK)
  7302.     End Sub
  7303.  
  7304.     Sub CBShowEmbeds_Click()
  7305.       ObjList.ShowEmbeds = CBShowEmbeds.Value = "Checked"
  7306.     End Sub
  7307.  
  7308.     Sub CBUntyped_Click()
  7309.       ObjList.Enabled = CBUntyped.Value <> "Checked"
  7310.       CBShowEmbeds.Enabled = ObjList.Enabled
  7311.     End Sub
  7312.  
  7313.     Function IsLegalKey(keyAscii As Integer) As Integer
  7314.       Select Case keyAscii
  7315.         Case VK_BACK, Asc(" "), Asc("."), Asc("0") To Asc("9"), Asc("A") To Asc("z")
  7316.           IsLegalKey = True
  7317.         Case Else
  7318.           IsLegalKey = False
  7319.       End Select
  7320.     End Function
  7321.  
  7322.     Sub ObjList_KeyPress(keyAscii As Integer)
  7323.       dim newselection as integer
  7324.       newselection = -1
  7325.     
  7326.       ' Process particular keys, and set "newselection" if key is processed.
  7327.       If (keyAscii = VK_BACK) Then 
  7328.         Label1.Text = Left(Label1.Text, Len(Label1.Text) - 1)
  7329.         newselection = ObjList.FindString(Label1.Text, -1)
  7330.       ElseIf keyAscii = Asc(" ") || IsLegalKey(keyAscii) Then 
  7331.         dim newstring as string
  7332.         If keyAscii = Asc(" ") Then 
  7333.           newselection = ObjList.FindString(Label1.Text, ObjList.ListIndex)
  7334.           newstring = Label1.Text
  7335.         Else 
  7336.           newstring = Label1.Text & Chr(keyAscii)
  7337.           newselection = ObjList.FindString(newstring, -1)
  7338.         End If
  7339.         If newselection = -1 Then keyAscii = 0 : Exit Sub
  7340.         Label1.Text = newstring
  7341.       End If
  7342.     
  7343.       If (newselection <> -1) Then 
  7344.         ' Suppress keystroke that generated new selection
  7345.         ObjList.ListIndex = newselection
  7346.         keyAscii = 0
  7347.       End If
  7348.     End Sub
  7349.  
  7350.     Sub ObjList_MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
  7351.       Label1.Text = ""
  7352.     End Sub
  7353.  
  7354.     Sub Resize()
  7355.       Dim m, mm, l, t, w, h, effWidth As Single
  7356.       m = 90 : mm = 180
  7357.       effWidth = IIf(ScaleWidth < 4370, 4370, ScaleWidth)
  7358.     
  7359.       t = CBReference.Top : w = CBReference.Width : h = CBReference.Height
  7360.       l = effWidth - w - m
  7361.       CBReference.Move(l, t, w, h)
  7362.       CBUntyped.Move(l, t + h + m, w, h)
  7363.     
  7364.       w = BtnOk.Width : h = BtnOk.Height
  7365.       l = effWidth - w - m
  7366.       BtnOk.Move(l, m, w, h)
  7367.       BtnCancel.Move(l, BtnOk.Top + h + m, w, h)
  7368.     
  7369.       w = CBReference.Left - m - ObjList.Left
  7370.       ObjList.Width = w
  7371.       Label1.Width = w
  7372.     
  7373.       t = ObjList.Top
  7374.       h = ScaleHeight - t - mm - CBShowEmbeds.Height
  7375.       CBShowEmbeds.Top = t + h + m
  7376.       ObjList.Height = h
  7377.       Refresh
  7378.     End Sub
  7379.  
  7380.     Function ShowModal() As Long
  7381.       dim f strictly As Form
  7382.     
  7383.       ' Make sure Form is created and shown, so configurations below stick.
  7384.       LoadForm()
  7385.       Show()
  7386.     
  7387.       Label1.Text = ""
  7388.       ObjList.Reset()
  7389.       ObjList.SetFocus()
  7390.     
  7391.       f = Me
  7392.       ShowModal = f.ShowModal
  7393.     End Function
  7394.  
  7395.   End Type
  7396.  
  7397.   ' METHODS for object: PropertyEditor
  7398.   Function ArrayConfig(dimStmt As String) As Integer
  7399.     ArrayConfig = DimensionArrayForm.Execute(dimStmt)
  7400.   End Function
  7401.  
  7402.   Function DblClick() As Integer
  7403.     ' Initialize the "handled" state of Event to not true.
  7404.     DblClick = False
  7405.   
  7406.     ' Independent of all else, Handle Embedded forms
  7407.     If SelPropIsEmbed Then 
  7408.       Dim obj as Object
  7409.       obj = FindObject(SelPropString)
  7410.       If obj && ObjectEditorMgr.DetailedEdit(obj) Then 
  7411.         ' A specialized ObjectEditor handled the event.
  7412.         Refresh("ChangedProperty")
  7413.         DblClick = True
  7414.       End If
  7415.     Else 
  7416.       If ObjectEditorMgr.PropertyEdit(SelPropObject) || GenericPropertyEdit() Then 
  7417.         ' A specialized ObjectEditor handled the event.
  7418.         Refresh("ChangedProperty")
  7419.         DblClick = True
  7420.       End If
  7421.     End If
  7422.   End Function
  7423.  
  7424.   Function EnumPick(enumName As String) As Integer
  7425.     If EnumPicker.ShowModal() = IDOK Then 
  7426.       enumName = EnumPicker.EnumList.Text
  7427.       EnumPick = 1
  7428.     Else 
  7429.       EnumPick = -1
  7430.     End If
  7431.   End Function
  7432.  
  7433.   Function GenericPropertyEdit() As Long
  7434.     Dim fName As String
  7435.     fName = SelPropName
  7436.   
  7437.     ' Initialize handled status to not true
  7438.     GenericPropertyEdit = False
  7439.   
  7440.     ' Handle Color Field for all object types
  7441.     If Instr(fName, "Color") && SelPropType = 1 Then 
  7442.       ColorDialog.Title = fName
  7443.       ColorDialog.Color = SelPropString
  7444.       If ColorDialog.Execute = 1 Then 
  7445.         SelPropAssign(ColorDialog.Color)
  7446.         GenericPropertyEdit = True
  7447.       End If
  7448.   
  7449.       ' Handle Font Reference Field For all object types
  7450.     ElseIf (StrComp(fName, "Font") = 0) && Not SelPropIsEmbed Then 
  7451.       GenericPropertyEdit = SetWindowFont(SelPropObject)
  7452.     End If
  7453.   
  7454.   End Function
  7455.  
  7456.   Sub Help()
  7457.     If SelPropIsEmbed Then 
  7458.       Envelop.Help.ShowObjectHelp(FindEmbed(SelPropObject, SelPropName))
  7459.     Else 
  7460.       Envelop.Help.ShowPropertyHelp(SelPropName, SelPropObject)
  7461.     End If
  7462.   End Sub
  7463.  
  7464.   Function ObjPick(asReference As Integer, result As Integer) As Object
  7465.     If ObjPicker.ShowModal() = IDOK Then 
  7466.       asReference = ObjPicker.CBReference.Value = "Checked"
  7467.       ObjPick = IIf(ObjPicker.CBUntyped.Value = "Checked", Nothing, ObjPicker.ObjList.SelObject)
  7468.       result = 1
  7469.     Else 
  7470.       result = -1
  7471.     End If
  7472.   End Function
  7473.  
  7474.   Function SetWindowFont(ByVal w as Window) As Integer
  7475.     dim editFont as Font
  7476.   
  7477.     ' Default to no change
  7478.     SetWindowFont = False
  7479.   
  7480.     ' If there is not a Font object to edit already, make a temporary one to work
  7481.     ' on until "OK" is pressed on FontDialog.
  7482.     If Not w.Font Then 
  7483.       editFont = CopyObject(Font, "")
  7484.     Else 
  7485.       editFont = w.Font
  7486.     End If
  7487.   
  7488.     ' Use font dialog to configure the font passed in.
  7489.     FontDialog.Title = w & "." & SelPropName
  7490.     FontDialog.Font = editFont
  7491.     FontDialog.Color = w.ForeColor
  7492.   
  7493.     If FontDialog.Execute = 1 Then 
  7494.       ' Embed a Font object is not already there.
  7495.       If Not w.Font Then 
  7496.         ' Copy the object from 'editFont', will copy all the configured properties.
  7497.         w.Font := EmbedObject(w, editFont, UniqueEmbedName(w, "font"))
  7498.       End If
  7499.       w.ForeColor = FontDialog.Color
  7500.       SetWindowFont = True
  7501.     End If
  7502.   
  7503.   End Function
  7504.  
  7505. End Type
  7506.  
  7507. Type MenuTester From Form
  7508.   Dim Label1 As New Label
  7509.   Dim font1 As New Font
  7510. End Type
  7511.  
  7512. Type MenuEditor From MenuEditor
  7513.   Type SelectPopupForm From Form
  7514.     Dim CBPopups As New ObjectCombo
  7515.     Dim OptExisting As New OptionButton
  7516.     Dim OptNew As New OptionButton
  7517.     Dim LblCaption As New Label
  7518.     Dim TECaption As New TextBox
  7519.     Dim TEName As New TextBox
  7520.     Dim BtnOK As New Button
  7521.     Dim BtnCancel As New Button
  7522.     Dim HostMenu As Menu
  7523.     Dim LblName As New Label
  7524.  
  7525.     ' METHODS for object: MenuEditor.SelectPopupForm
  7526.     Sub BtnCancel_Click()
  7527.       Hide
  7528.       ModalResult IDCANCEL
  7529.     End Sub
  7530.  
  7531.     Sub BtnOK_Click()
  7532.       If OptNew.Value Then 
  7533.         Dim newName As String
  7534.         newName = TEName.Text
  7535.         If IsIdentifierValid(newName) = 0 Then 
  7536.           Dim mb As New MessageBox
  7537.           mb.SetIconExclamation
  7538.           mb.Message("Invalid identifier", """" & newName & """ is not a valid object name")
  7539.           Exit Sub
  7540.         End If
  7541.       End If
  7542.       Hide
  7543.       ModalResult IDOK
  7544.     End Sub
  7545.  
  7546.     Function Execute(host As Menu, caption As String, handled As Integer) As PopupMenu
  7547.       Dim result As Integer
  7548.       LoadForm
  7549.       Font = DefaultDialogFont
  7550.       HostMenu = host
  7551.       OptNew.Value = True
  7552.       OptNew_Click
  7553.       CBPopups.SetFocus
  7554.       CBPopups.Reset
  7555.       result = ShowModal
  7556.       HostMenu = Nothing
  7557.       If result = IDOK Then 
  7558.         Dim popup As PopupMenu
  7559.         If OptExisting.Value Then 
  7560.           popup = CBPopups.SelObject
  7561.         Else 
  7562.           If host Then 
  7563.             popup = EmbedObject(host, FindObject("PopupMenu"), TEName.Text)
  7564.           Else 
  7565.             popup = CopyObject(FindObject("PopupMenu"), TEName.Text)
  7566.           End If
  7567.         End If
  7568.         caption = TECaption.Text
  7569.         If caption = "" Then  ' Fill in a default caption
  7570.           Dim nm As String
  7571.           Dim pos, lastPos As Integer
  7572.           nm = popup
  7573.           Do
  7574.             pos = Instr(nm, ".")
  7575.             If pos Then nm = Mid$(nm, pos + 1)
  7576.           Loop While pos <> 0
  7577.           caption = nm
  7578.         End If
  7579.         handled = IDOK
  7580.         Execute = popup
  7581.       Else 
  7582.         handled = IDCANCEL
  7583.       End If
  7584.     End Function
  7585.  
  7586.     Sub OptExisting_Click()
  7587.       CBPopups.Visible = True
  7588.       TEName.Visible = False
  7589.     End Sub
  7590.  
  7591.     Sub OptNew_Click()
  7592.       CBPopups.Visible = False
  7593.       TEName.Visible = True
  7594.       If HostMenu Then 
  7595.         TEName.Text = UniqueEmbedName(HostMenu, "Popup")
  7596.       Else 
  7597.         TEName.Text = UniqueObjectNameFromString("PopupMenu")
  7598.       End If
  7599.     End Sub
  7600.  
  7601.     Sub Resize()
  7602.       Dim m, mm, l, t, w, h As Single
  7603.       Dim effWidth As Single
  7604.       m = 90 : mm = 180
  7605.       effWidth = IIf(ScaleWidth < 5000, 5000, ScaleWidth)
  7606.       w = BtnOK.Width
  7607.       h = BtnOK.Height
  7608.       l = effWidth - m - w
  7609.       BtnOK.Move(l, m, w, h)
  7610.       BtnCancel.Move(l, BtnOK.Top + h + m, w, h)
  7611.       l = CBPopups.Left
  7612.       h = CBPopups.Height
  7613.       w = BtnOK.Left - mm - l
  7614.       CBPopups.Move(l, CBPopups.Top, w, h)
  7615.       TEName.Move(l, TEName.Top, w, h)
  7616.       TECaption.Move(l, TECaption.Top, w, h)
  7617.       Refresh
  7618.     End Sub
  7619.  
  7620.   End Type
  7621.  
  7622.   ' METHODS for object: MenuEditor
  7623.   Sub Help()
  7624.     Envelop.Help.ShowTopicHelp("Menu_Editor")
  7625.   End Sub
  7626.  
  7627.   Function SelectPopup(container As Menu, caption As String, handled As Integer) As Object
  7628.     SelectPopup = SelectPopupForm.Execute(container, caption, handled)
  7629.   End Function
  7630.  
  7631. End Type
  7632.  
  7633. Type CtrlToolGadgetWizard From WizardMaster.Wizard
  7634.   Type SelectObject From WizardMaster.FrmStep
  7635.     Dim TextBox1 As New TextBox
  7636.   End Type
  7637.   Type SelectBitmap From WizardMaster.FrmStep
  7638.     Dim TextBox1 As New TextBox
  7639.     Dim BTNBrowse As New Button
  7640.     Dim BTNPreview As New Button
  7641.     Type SampleBox From ObjectBox
  7642.       Dim PreviewTool As New ToolGadget
  7643.  
  7644.       ' METHODS for object: CtrlToolGadgetWizard.SelectBitmap.SampleBox
  7645.       Sub Reposition
  7646.         dim l,t,w,h as long
  7647.         w = (PreviewTool.bitmap.Width + 4) * 15
  7648.         If w > 4125 Then w = 4125
  7649.         If w < 150 Then w = 150
  7650.         h = (PreviewTool.bitmap.Height + 4) * 15
  7651.         If h > 1575 Then h = 1575
  7652.         If h < 150 Then h = 150
  7653.         l = 2850 + ((4125 - w) / 2)
  7654.         t = 2175 + ((1575 - h) / 2)
  7655.         Move(l, t, w, h)
  7656.         PreviewTool.Refresh
  7657.         ForceLayout(True)
  7658.       End Sub
  7659.  
  7660.     End Type
  7661.  
  7662.     ' METHODS for object: CtrlToolGadgetWizard.SelectBitmap
  7663.     Sub BTNBrowse_Click()
  7664.       Dim length As Integer
  7665.       Dim open as New OpenDialog
  7666.     
  7667.       ' Set the title of the open dialog just before we display it.
  7668.       open.Title = "Configure Tool Gadget"
  7669.     
  7670.       ' Set the filter to look for bitmaps
  7671.       open.Filter = "Bitmap files|*.bmp|"
  7672.     
  7673.       ' Set the change directory
  7674.       open.NoChangeDir = False
  7675.     
  7676.       ' If a filename was picked, then remember it
  7677.       ' Let the picture on this wizard preview it
  7678.       If open.Execute <> IDCANCEL Then 
  7679.         TextBox1.Text = open.FileName
  7680.         BTNPreview_Click
  7681.       End If
  7682.     End Sub
  7683.  
  7684.     Sub BTNPreview_Click()
  7685.       If TextBox1.Text <> "" Then 
  7686.         SampleBox.PreviewTool.bitmap.LoadType = "FileBased"
  7687.         SampleBox.PreviewTool.bitmap.FileName = TextBox1.Text
  7688.         SampleBox.PreviewTool.bitmap.LoadType = "MemoryBased"
  7689.       End If
  7690.       SampleBox.Reposition
  7691.     End Sub
  7692.  
  7693.   End Type
  7694.   Dim ng As ControlTools.Gadget
  7695.  
  7696.   ' METHODS for object: CtrlToolGadgetWizard
  7697.   Sub Cancel()
  7698.     If ng Then 
  7699.       ng.GadgetObject = ""
  7700.       ng.bitmap.LoadType = "FileBased"
  7701.       ng.bitmap.FileName = ""
  7702.       ng.bitmap.LoadType = "MemoryBased"
  7703.     End If
  7704.   End Sub
  7705.  
  7706.   Sub SelectBitmap_ValidateDisplay(ok As Boolean)
  7707.     If Not SelectBitmap.initialized Then 
  7708.       ' If the new gadget's bitmap is not configured yet, give it a default
  7709.       With ng.bitmap
  7710.         If (.Width + .Height = 0) Then 
  7711.           ' The default is in the EVDEV.DLL as Resource 3100.
  7712.           .LoadType = "ResourceBased"
  7713.           .FileName = "evdev.dll"
  7714.           .ResId = 3100
  7715.           .LoadType = "MemoryBased"
  7716.           .FileName = ""
  7717.         End If
  7718.         ' copy the bitmap from the gadget into the preview area
  7719.         SelectBitmap.SampleBox.PreviewTool.bitmap.SetPicture(.GetPicture())
  7720.       End With
  7721.   
  7722.       SelectBitmap.SampleBox.ForceLayout(True)
  7723.       SelectBitmap.initialized = True
  7724.     End If
  7725.     SelectBitmap.TextBox1.Text = ng.bitmap.FileName
  7726.     SelectBitmap.BTNPreview_Click
  7727.   End Sub
  7728.  
  7729.   Sub SelectBitmap_ValidateFinish(ok As Boolean)
  7730.     If ng Then 
  7731.       If SelectBitmap.TextBox1.Text <> "" Then 
  7732.         ng.bitmap.LoadType = "FileBased"
  7733.         ng.bitmap.FileName = SelectBitmap.TextBox1.Text
  7734.         ng.bitmap.LoadType = "MemoryBased"
  7735.       Else 
  7736.         ng.bitmap.SetPicture SelectBitmap.SampleBox.PreviewTool.bitmap.GetPicture
  7737.       End If
  7738.       If ng.Parent Then ng.Parent.ForceLayout(True)
  7739.     End If
  7740.   End Sub
  7741.  
  7742.   Sub SelectObject_ValidateDisplay(ok As Boolean)
  7743.     If ng Then 
  7744.       SelectObject.TextBox1.Text = ng.GadgetObject
  7745.     End If
  7746.   End Sub
  7747.  
  7748.   Sub SelectObject_ValidateFinish(ok As Boolean)
  7749.     SelectObject_ValidateNext(ok)
  7750.   End Sub
  7751.  
  7752.   Sub SelectObject_ValidateNext(ok As Boolean)
  7753.     If ng Then ng.GadgetObject = FindObject(SelectObject.TextBox1.Text)
  7754.   
  7755.     ' May want to add next line:
  7756.     ' If ng.GadgetObject = Nothing then WARNING
  7757.   End Sub
  7758.  
  7759. End Type
  7760.  
  7761. Type GroupEditor From ObjectEditor
  7762.   Property Visible Get getVisible Set setVisible As Boolean
  7763.   Type EditorForm From Form
  7764.     Dim GroupRef As Object
  7765.     Dim GroupList As New ListBox
  7766.     Dim ParentForReal As GroupEditor
  7767.     Dim Up As New Button
  7768.     Dim Down As New Button
  7769.     Dim Delete As New Button
  7770.  
  7771.     ' METHODS for object: GroupEditor.EditorForm
  7772.     Function CurrentPosition() As Long
  7773.       CurrentPosition = GroupList.ListIndex
  7774.     End Function
  7775.  
  7776.     Function CursorPosition(y as single) As Long
  7777.       dim pos as long
  7778.       ' Identify list position for a given cursor location
  7779.       pos = y / GroupList.ItemHeight
  7780.       If pos > GroupList.ListCount Then pos = GroupList.ListCount
  7781.       CursorPosition = pos
  7782.     End Function
  7783.  
  7784.     Sub Delete_Click()
  7785.       Dim obj as Object
  7786.       Dim i as integer
  7787.     
  7788.       ' If no selection, bail
  7789.       i = GroupList.ListIndex
  7790.       If i < 0 Then Exit Sub
  7791.     
  7792.       ' Delete the object at the selected index
  7793.       obj = GetCurrentObject()
  7794.       If obj Then 
  7795.         GroupRef.RemoveAt(i)
  7796.         If i >= GroupRef.Count Then i = GroupRef.Count - 1
  7797.         PopulateEditor(i)
  7798.       End If
  7799.     End Sub
  7800.  
  7801.     Sub Down_Click()
  7802.       Dim obj as Object
  7803.       Dim i, cnt as integer
  7804.     
  7805.       ' If list has no more than 1 member or the selected item is
  7806.       ' already at the bottom then do nothing
  7807.       i = GroupList.ListIndex
  7808.       cnt = GroupList.ListCount
  7809.       If cnt <= 1 || i >= cnt - 1 Then Exit Sub
  7810.     
  7811.       ' Get current object, remove it from group, add it back in
  7812.       ' one position down
  7813.       obj = GetCurrentObject()
  7814.       If obj Then 
  7815.         GroupRef.RemoveAt(i)
  7816.         If i = cnt - 2 Then 
  7817.           GroupRef.Append(obj)
  7818.           i = cnt - 1
  7819.         Else 
  7820.           GroupRef.InsertAt(obj, i + 1)
  7821.           i = i + 1
  7822.         End If
  7823.       End If
  7824.     
  7825.       ' Rebuild the list and lets see it
  7826.       PopulateEditor(i)
  7827.     End Sub
  7828.  
  7829.     Sub Edit(obj As Object)
  7830.       ' If there's no object to edit or its
  7831.       ' not the right type, forget it.
  7832.       If Not obj Then Exit Sub
  7833.       If Not TypeOf obj Is Group && Not TypeOf obj Is ControlGroup Then Exit Sub
  7834.     
  7835.       ' Set our caption and group reference, then populate the list
  7836.       Caption = "Group: " & obj
  7837.       GroupRef = obj
  7838.       PopulateEditor(-1)
  7839.     End Sub
  7840.  
  7841.     Function  GetCurrentObject() As Object
  7842.       GetCurrentObject = FindObject(GroupList.Text)
  7843.     End Function
  7844.  
  7845.     Function GetObjectCount(obj as Object) As Integer
  7846.       Dim manip as Integer
  7847.     
  7848.       If Not TypeOf obj Is Group && Not TypeOf obj Is ControlGroup Then Exit Function
  7849.     
  7850.       ' Set GroupRef and object count
  7851.       GroupRef = obj
  7852.       GetObjectCount = IIf(obj, obj.Count, 0)
  7853.     
  7854.       ' Enable the group manipulations for simple groups
  7855.       manip = (obj <> Nothing) && (TypeOf obj Is Group)
  7856.       Up.Enabled = manip
  7857.       Down.Enabled = manip
  7858.       Delete.Enabled = manip
  7859.     End Function
  7860.  
  7861.     Sub GroupList_DblClick()
  7862.       dim obj as Object
  7863.       ' Double clicking an entry in the group list Edits it
  7864.       obj = GetCurrentObject()
  7865.       If obj Then ObjectEditorMgr.ResetOthers(GroupEditor, obj)
  7866.     End Sub
  7867.  
  7868.     Sub GroupList_DragAndDrop(source As XferData, x As Single, y As Single, state As OleDropState, effect As OleDropEffect)
  7869.       effect = 0
  7870.       If GroupRef && TypeOf GroupRef Is Group Then 
  7871.         effect = 1
  7872.         If state = 3 Then 
  7873.           OG_DragAndDrop(source, x, y, state, effect)
  7874.         Else 
  7875.           GroupList.ListIndex = CursorPosition(y)
  7876.         End If
  7877.       End If
  7878.     End Sub
  7879.  
  7880.     Sub GroupList_DragStart(data as XferData, x As Single, y As Single)
  7881.       dim obj as Object
  7882.     
  7883.       ' Start a drag with the current object
  7884.       obj = GetCurrentObject()
  7885.       If obj Then 
  7886.         data.ObjectRef = obj
  7887.         data.Drag(1)
  7888.       End If
  7889.     End Sub
  7890.  
  7891.     Sub GroupList_KeyDown(keyCode As Integer, ByVal shift As Integer)
  7892.       ' If he hits delete and we have an object and we can delete it
  7893.       ' then do it.
  7894.       If (keyCode = VK_DELETE && GroupList.ListIndex <> -1) Then 
  7895.         If Delete.Enabled Then Delete_Click
  7896.       End If
  7897.     
  7898.       If (keyCode = VK_F1) Then Envelop.Help.ShowTopicHelp("Group_Editor")
  7899.     End Sub
  7900.  
  7901.     Sub Load()
  7902.       If GroupRef Then 
  7903.         PopulateEditor(-1)
  7904.       End If
  7905.     End Sub
  7906.  
  7907.     Sub OG_DragAndDrop(source as XferData, x as Single, y as Single, state as OleDropState, effect as OleDropEffect)
  7908.       dim idx as integer
  7909.       dim obj as Object
  7910.     
  7911.       ' Add the dragged object into the list at the positon
  7912.       ' given by the cursor location
  7913.       obj = source.ObjectRef
  7914.       idx = CursorPosition(y)
  7915.       If (idx > 0 && idx < GroupRef.Count) Then 
  7916.         GroupRef.InsertAt(obj, idx)
  7917.       ElseIf (idx <= 0) Then 
  7918.         idx = 0
  7919.         GroupRef.Prepend(obj)
  7920.       ElseIf (idx >= GroupRef.Count) Then 
  7921.         GroupRef.Append(obj)
  7922.         idx = GroupRef.Count - 1
  7923.       End If
  7924.     
  7925.       ' Rebuild the list and lets see it
  7926.       PopulateEditor(idx)
  7927.     End Sub
  7928.  
  7929.     Sub PopulateEditor(ind as Integer)
  7930.       dim i as Integer
  7931.       dim count as Integer
  7932.     
  7933.       ' Add the objects in the group to the list
  7934.       ' after clearing it first
  7935.       GroupList.Clear
  7936.       count = GetObjectCount(GroupRef)
  7937.       If (count > 0) Then 
  7938.         For i = 0 To count - 1
  7939.           GroupList.AddItem(GroupRef(i))
  7940.         Next i
  7941.       End If
  7942.     
  7943.       ' Set selection to requested index
  7944.       GroupList.ListIndex = ind
  7945.     End Sub
  7946.  
  7947.     Sub Resize()
  7948.       ' Resize the list to take up the whole form but the
  7949.       ' button area.
  7950.       GroupList.Move(0, GroupList.Top, ScaleWidth, ScaleHeight)
  7951.       Height = Height - ScaleHeight + GroupList.Height
  7952.     End Sub
  7953.  
  7954.     Sub Up_Click()
  7955.       Dim obj as Object
  7956.       Dim i, cnt as integer
  7957.     
  7958.       ' If list has no more than 1 member or the selected item is
  7959.       ' already at the top then do nothing
  7960.       i = GroupList.ListIndex
  7961.       cnt = GroupList.ListCount
  7962.       If cnt <= 1 || i <= 0 Then Exit Sub
  7963.     
  7964.       ' Get current object, remove it from group, add it back in
  7965.       ' one position up
  7966.       obj = GetCurrentObject()
  7967.       If obj Then 
  7968.         GroupRef.RemoveAt(i)
  7969.         GroupRef.InsertAt(obj, i - 1)
  7970.       End If
  7971.     
  7972.       ' Rebuild the list and lets see it
  7973.       PopulateEditor(i - 1)
  7974.     End Sub
  7975.  
  7976.   End Type
  7977.  
  7978.   ' METHODS for object: GroupEditor
  7979.   Sub BringToTop()
  7980.     EditorForm.BringToTop()
  7981.   End Sub
  7982.  
  7983.   Sub Edit(obj As Object)
  7984.     EditorForm.Edit(obj)
  7985.   End Sub
  7986.  
  7987.   Function getVisible() As Boolean
  7988.     getVisible = EditorForm.Visible
  7989.   End Function
  7990.  
  7991.   Sub Hide()
  7992.     EditorForm.Hide()
  7993.   End Sub
  7994.  
  7995.   Sub setVisible(vis As Boolean)
  7996.     EditorForm.Visible = vis
  7997.   End Sub
  7998.  
  7999.   Sub Show()
  8000.     EditorForm.Show()
  8001.   End Sub
  8002.  
  8003. End Type
  8004.  
  8005. Type NewProjectForm From Form
  8006.   Dim LblProjType As New Label
  8007.   Dim LblProjName As New Label
  8008.   Dim LblProjFile As New Label
  8009.   Dim OptApplication As New OptionButton
  8010.   Dim OptLibrary As New OptionButton
  8011.   Dim LblEXEfile As New Label
  8012.   Dim TEProjName As New TextBox
  8013.   Dim TEProjFile As New TextBox
  8014.   Dim TEEXEfile As New TextBox
  8015.   Dim BtnOK As New Button
  8016.   Dim BtnCancel As New Button
  8017.   Dim BtnBrowseProjFile As New Button
  8018.   Dim BtnBrowseEXEfile As New Button
  8019.   Dim GeneratedName As String
  8020.  
  8021.   ' METHODS for object: NewProjectForm
  8022.   Sub BtnBrowseEXEfile_Click()
  8023.     Dim dlg As New OpenDialog
  8024.     Dim name As String
  8025.     name = TEEXEfile.Text
  8026.     If name <> "" Then 
  8027.       Dim file As New File
  8028.       file.FileName = name
  8029.       dlg.FileName = file.Name & file.Extension
  8030.       dlg.InitialDir = IIf(Instr(name, "\") > 0, file.Path, Envelop.FileDialogDir)
  8031.     Else 
  8032.       dlg.FileName = "*.exe"
  8033.       dlg.InitialDir = Envelop.FileDialogDir
  8034.     End If
  8035.     dlg.Title = "Select application EXE file"
  8036.     dlg.Filter = "Executable files (*.exe)|*.exe|All files (*.*)|*.*|"
  8037.     dlg.DefaultExtension = "exe"
  8038.     dlg.FilterIndex = 1
  8039.     dlg.FileMustExist = False
  8040.     dlg.PathMustExist = True
  8041.     dlg.NoChangeDir = True
  8042.     If dlg.Execute = IDOK Then 
  8043.       TEEXEfile.Text = dlg.FileName
  8044.       Envelop.FileDialogDir = dlg.FileName
  8045.     End If
  8046.   End Sub
  8047.  
  8048.   Sub BtnBrowseProjFile_Click()
  8049.     Dim dlg As New OpenDialog
  8050.     Dim name As String
  8051.     name = TEProjFile.Text
  8052.     If name <> "" Then 
  8053.       Dim file As New File
  8054.       file.FileName = name
  8055.       dlg.FileName = file.Name & file.Extension
  8056.       dlg.InitialDir = IIf(Instr(name, "\") > 0, file.Path, Envelop.FileDialogDir)
  8057.     Else 
  8058.       dlg.FileName = "*.epj"
  8059.       dlg.InitialDir = Envelop.FileDialogDir
  8060.     End If
  8061.     dlg.Title = "Select project file"
  8062.     dlg.Filter = "Envelop projects (*.epj)|*.epj|All files (*.*)|*.*|"
  8063.     dlg.DefaultExtension = "epj"
  8064.     dlg.FilterIndex = 1
  8065.     dlg.FileMustExist = False
  8066.     dlg.PathMustExist = True
  8067.     dlg.NoChangeDir = True
  8068.     If dlg.Execute = IDOK Then 
  8069.       TEProjFile.Text = dlg.FileName
  8070.       If OptApplication.Value Then 
  8071.         Dim fle as New File
  8072.         fle.FileName = dlg.FileName
  8073.         TEEXEfile.Text = fle.Path & fle.Name & ".exe"
  8074.       End If
  8075.       Envelop.FileDialogDir = dlg.FileName
  8076.     End If
  8077.   End Sub
  8078.  
  8079.   Sub BtnCancel_Click()
  8080.     Hide
  8081.     ModalResult IDCANCEL
  8082.   End Sub
  8083.  
  8084.   Sub BtnOK_Click()
  8085.     Dim name as string
  8086.     Dim answer as integer
  8087.     Dim mb As New MessageBox
  8088.     mb.SetIconExclamation
  8089.   
  8090.     ' Check that we have a valid project object name.
  8091.     name = TEProjName.Text
  8092.     If name = "" Then 
  8093.       mb.Message("Invalid project name", "To make a new project, you must^Mspecify a valid new project object name.")
  8094.       FocusOnTE TEProjName
  8095.       Exit Sub
  8096.     ElseIf IsIdentifierValid(name) = 0 Then 
  8097.       mb.Message("Invalid project name", """" & name & """ is not a valid object name.^M^MTo make a new project, you must ^Mspecify a valid new project object name.")
  8098.       FocusOnTE TEProjName
  8099.       Exit Sub
  8100.     ElseIf FindObject(name) Then 
  8101.       mb.Message("Invalid project name", "The object """ & name & """ already exists.^M^MTo make a new project, you must ^Mspecify a valid new project object name.")
  8102.       FocusOnTE TEProjName
  8103.       Exit Sub
  8104.     End If
  8105.   
  8106.     ' Check that the specified project file can be written.
  8107.     ' Allow the user to continue if she really wants to.
  8108.     name = TEProjFile.Text
  8109.     If name = "" Then 
  8110.       answer = YesNoBox.Message("No project file name", "You have not specified a project file.^MDo you wish to continue anyway?")
  8111.       If answer <> IDYES Then 
  8112.         FocusOnTE TEProjFile
  8113.         Exit Sub
  8114.       End If
  8115.     Else 
  8116.       Dim file As New TextFile
  8117.       file.FileName = name
  8118.       If file.Exists Then 
  8119.         answer = YesNoBox.Message("Project file exists", "The project file you selected already exists.^MDo you wish to continue anyway?")
  8120.         If answer <> IDYES Then 
  8121.           FocusOnTE TEProjFile
  8122.           Exit Sub
  8123.         End If
  8124.         If file.ReadOnly Then 
  8125.           answer = YesNoBox.Message("Read-only project file", "The project file you selected is read-only.^MDo you wish to continue anyway?")
  8126.           If answer <> IDYES Then 
  8127.             FocusOnTE TEProjFile
  8128.             Exit Sub
  8129.           End If
  8130.         End If
  8131.       Else 
  8132.         Try
  8133.           file.Create(False)
  8134.         Catch
  8135.         End Try
  8136.         If Not file.Exists Then 
  8137.           answer = YesNoBox.Message("Can't make project file", "Unable to make project file: " & name & ".^MDo you wish to continue anyway?")
  8138.           If answer <> IDYES Then 
  8139.             FocusOnTE TEProjFile
  8140.             Exit Sub
  8141.           End If
  8142.         End If
  8143.         file.Delete
  8144.       End If
  8145.     End If
  8146.   
  8147.     ' Check that the specified EXE file can be written.
  8148.     ' Allow the user to continue if she really wants to.
  8149.     If OptApplication.Value Then 
  8150.       name = TEEXEfile.Text
  8151.       If name = "" Then 
  8152.         answer = YesNoBox.Message("No EXE file name", "You have not specified an application EXE file.^MDo you wish to continue anyway?")
  8153.         If answer <> IDYES Then 
  8154.           FocusOnTE TEEXEfile
  8155.           Exit Sub
  8156.         End If
  8157.       Else 
  8158.         Dim file As New TextFile
  8159.         file.FileName = name
  8160.         If file.Exists Then 
  8161.           answer = YesNoBox.Message("EXE file exists", "The application EXE file you selected already exists.^MDo you wish to continue anyway?")
  8162.           If answer <> IDYES Then 
  8163.             FocusOnTE TEEXEfile
  8164.             Exit Sub
  8165.           End If
  8166.           If file.ReadOnly Then 
  8167.             answer = YesNoBox.Message("Read-only EXE file", "The application EXE file you selected is read-only.^MDo you wish to continue anyway?")
  8168.             If answer <> IDYES Then 
  8169.               FocusOnTE TEEXEfile
  8170.               Exit Sub
  8171.             End If
  8172.           End If
  8173.         Else 
  8174.           Try
  8175.             file.Create(False)
  8176.           Catch
  8177.           End Try
  8178.           If Not file.Exists Then 
  8179.             answer = YesNoBox.Message("Can't make EXE file", "Unable to make application EXE file: " & name & ".^MDo you wish to continue anyway?")
  8180.             If answer <> IDYES Then 
  8181.               FocusOnTE TEEXEfile
  8182.               Exit Sub
  8183.             End If
  8184.           End If
  8185.           file.Delete
  8186.         End If
  8187.       End If
  8188.     End If
  8189.     Hide
  8190.     ModalResult IDOK
  8191.   End Sub
  8192.  
  8193.   Function DoExecute(ByVal auto As Boolean) As Project
  8194.     Dim name As String
  8195.     LoadForm
  8196.     Center
  8197.     OptApplication.Value = True
  8198.     OptLibrary.Value = False
  8199.     GenerateNames(True)
  8200.     TEEXEfile.Enabled = True
  8201.     BtnBrowseEXEfile.Enabled = True
  8202.   
  8203.     If auto || ShowModal = IDOK Then 
  8204.       DoExecute = MakeProject(OptApplication.Value, TEProjName.Text, TEProjFile.Text, TEEXEfile.Text)
  8205.     Else 
  8206.       DoExecute = Nothing
  8207.     End If
  8208.   End Function
  8209.  
  8210.   Function Execute As Project
  8211.     Execute = DoExecute(False)
  8212.   End Function
  8213.  
  8214.   Sub FocusOnTE(te As TextBox)
  8215.     te.SelStart = 0
  8216.     te.SelLength = 32768
  8217.     te.SetFocus
  8218.   End Sub
  8219.  
  8220.   Sub GenerateNames(app As Boolean)
  8221.     Dim name As String
  8222.     GeneratedName = UniqueObjectNameFromString(IIf(app, "Application", "Library"))
  8223.     TEProjName.Text = GeneratedName
  8224.     name = IIf(app, "app", "lib") & Mid(GeneratedName, IIf(app, 12, 8))
  8225.     TEProjFile.Text = name & ".epj"
  8226.     If app Then TEEXEfile.Text = name & ".exe"
  8227.   End Sub
  8228.  
  8229.   Function MakeDefaultProject As Project
  8230.     MakeDefaultProject = DoExecute(True)
  8231.   End Function
  8232.  
  8233.   Function MakeProject(ByVal makeApp As Boolean, ByVal objName As String, ByVal projFile As String, ByVal exeFile As String) As Project
  8234.     Dim m As ObjectModule
  8235.     Dim p As Project
  8236.     Dim f As Form
  8237.     Dim nm As String
  8238.     Dim file As New File
  8239.     Dim appOrProj As Object
  8240.   
  8241.     ' Open a new untitled module
  8242.     m = ModuleManager.LoadModule("", False)
  8243.   
  8244.     ' In that module, make the new project object and a new form
  8245.     appOrProj = IIf(makeApp, Application, Project)
  8246.     nm = IIf(objName = "", UniqueObjectNameFromString(IIf(makeApp, "Application", "Library")), objName)
  8247.     p = CopyObject(appOrProj, nm)
  8248.     f = CopyObject(Form, UniqueObjectNameFromString("Form"))
  8249.     f.Caption = f
  8250.   
  8251.     ' Secure the project object against deletion
  8252.     EmbedObject(p, ACL, "AccessControl")
  8253.     SecureObject(p, p.AccessControl)
  8254.     p.AccessControl.ObjectAccess = "110 - R,W,C,M,P"
  8255.   
  8256.     ' Set default options on the new project and make it current
  8257.     If makeApp Then 
  8258.       p.ModulePath = "base.ebo;win32.ebo;dialogs.ebo;tools.ebo;" & m.FileName
  8259.     Else 
  8260.       p.ModulePath = m.FileName
  8261.     End If
  8262.     If projFile <> "" Then 
  8263.       file.FileName = projFile
  8264.       p.ProjectFileName = file.Path & file.Name & file.Extension
  8265.     Else 
  8266.       p.ProjectFileName = ""
  8267.     End If
  8268.   
  8269.     If makeApp Then 
  8270.       If exeFile <> "" Then 
  8271.         file.FileName = exeFile
  8272.         p.EXEFileName = file.Path & file.Name & file.Extension
  8273.       Else 
  8274.         p.EXEFileName = ""
  8275.       End If
  8276.       p.MainForm = f
  8277.     End If
  8278.   
  8279.     ProjectManager.CurrentProject = p
  8280.     p.CurrentModule = m
  8281.     ObjectEditorMgr.Edit f
  8282.     MakeProject = p
  8283.   End Function
  8284.  
  8285.   Sub OptApplication_Click()
  8286.     If TEProjName.Text = GeneratedName Then 
  8287.       GenerateNames(True)
  8288.     End If
  8289.     LblEXEfile.Enabled = True
  8290.     TEEXEfile.Enabled = True
  8291.     BtnBrowseEXEfile.Enabled = True
  8292.   End Sub
  8293.  
  8294.   Sub OptLibrary_Click()
  8295.     If TEProjName.Text = GeneratedName Then 
  8296.       GenerateNames(False)
  8297.     End If
  8298.     LblEXEfile.Enabled = False
  8299.     TEEXEfile.Text = ""
  8300.     TEEXEfile.Enabled = False
  8301.     BtnBrowseEXEfile.Enabled = False
  8302.   End Sub
  8303.  
  8304.   Sub Resize
  8305.     Dim m, mm, l, t, w, h, decHeight, newHeight as integer
  8306.     Dim ActiveWidth as integer
  8307.   
  8308.     ' Initialize the variables
  8309.     m = 60
  8310.     mm = m + m
  8311.     ActiveWidth = IIf(ScaleWidth > 4800, ScaleWidth, 4800)
  8312.   
  8313.     ' Make height just the size to show everything
  8314.     decHeight = Height - ScaleHeight
  8315.     newHeight = BtnBrowseEXEfile.Top + BtnBrowseEXEfile.Height + m + decHeight
  8316.     If newHeight <> Height Then 
  8317.       Height = newHeight
  8318.     Else 
  8319.       l = ActiveWidth - m - BtnOK.Width
  8320.       BtnCancel.Left = l
  8321.       BtnOK.Left = l
  8322.       w = BtnBrowseEXEfile.Width
  8323.       l = ActiveWidth - m - w
  8324.       BtnBrowseEXEfile.Left = l
  8325.       BtnBrowseProjFile.Left = l
  8326.   
  8327.       w = l - TEProjName.Left - m
  8328.       TEEXEfile.Width = w
  8329.       TEProjFile.Width = w
  8330.       TEProjName.Width = w
  8331.   
  8332.       Refresh
  8333.     End If
  8334.   End Sub
  8335.  
  8336. End Type
  8337.  
  8338. Type SelectModuleForm From Form
  8339.   Dim LstModules As New ListBox
  8340.   Dim BtnOK As New Button
  8341.   Dim BtnCancel As New Button
  8342.   Dim BtnBrowse As New Button
  8343.   Dim LblModules As New Label
  8344.   Dim module As ObjectModule
  8345.   Dim BtnNew As New Button
  8346.  
  8347.   ' METHODS for object: SelectModuleForm
  8348.   Sub BtnBrowse_Click()
  8349.     module = Envelop.EBOOpen.BrowseForModule
  8350.     If module Then BtnOK_Click Else BtnCancel_Click
  8351.   End Sub
  8352.  
  8353.   Sub BtnCancel_Click()
  8354.     Hide
  8355.     ModalResult IDCANCEL
  8356.   End Sub
  8357.  
  8358.   Sub BtnNew_Click()
  8359.     module = ModuleManager.LoadModule("", False)
  8360.     If module Then BtnOK_Click Else BtnCancel_Click
  8361.   End Sub
  8362.  
  8363.   Sub BtnOK_Click()
  8364.     Hide
  8365.     ModalResult IDOK
  8366.   End Sub
  8367.  
  8368.   Function Execute(t As String) As ObjectModule
  8369.     InitModuleList(Nothing, Nothing, Nothing)
  8370.     BtnNew.Visible = True
  8371.     BtnBrowse.Visible = True
  8372.     Caption = IIf(t = "", "Select module", t)
  8373.     Execute = IIf(ShowModal = IDOK, module, Nothing)
  8374.   End Function
  8375.  
  8376.   Function ExecuteExcluding(x As Group, t As String) As ObjectModule
  8377.     InitModuleList(Nothing, x, Nothing)
  8378.     BtnNew.Visible = True
  8379.     BtnBrowse.Visible = True
  8380.     Caption = IIf(t = "", "Select module", t)
  8381.     ExecuteExcluding = IIf(ShowModal = IDOK, module, Nothing)
  8382.   End Function
  8383.  
  8384.   Function ExecuteFromGroupOnly(g As Group, initMod As ObjectModule, t As String) As ObjectModule
  8385.     InitModuleList(g, Nothing, initMod)
  8386.     BtnNew.Visible = False
  8387.     BtnBrowse.Visible = False
  8388.     Caption = IIf(t = "", "Select module", t)
  8389.     ExecuteFromGroupOnly = IIf(ShowModal = IDOK, module, Nothing)
  8390.   End Function
  8391.  
  8392.   Sub InitModuleList(initial As Group, exclude As Group, initMod As ObjectModule)
  8393.     Dim i, n as integer
  8394.     Dim m as ObjectModule
  8395.     LoadForm
  8396.     module = Nothing
  8397.     LstModules.Clear
  8398.     LstModules.Sorted = False
  8399.   
  8400.     ' Use initial group if given, otherwise all modules.
  8401.     n = IIf(initial, initial.Count, ModuleManager.ModuleCount) - 1
  8402.     For i = 0 To n
  8403.       m = IIf(initial, initial(i), ModuleManager.Module(i))
  8404.       If (exclude = Nothing) || (exclude.ObjectIndex(m) = -1) Then 
  8405.         LstModules.AddItem m.DisplayName
  8406.       End If
  8407.     Next i
  8408.   
  8409.     ' Select given initial module, or current module, or first module
  8410.     If LstModules.ListCount Then 
  8411.       m = IIf(initMod, initMod, ModuleManager.CurrentModule)
  8412.       LstModules.ListIndex = IIf(m, LstModules.ItemIndex(m.DisplayName), 0)
  8413.     End If
  8414.     Show
  8415.     LstModules.SetFocus
  8416.   End Sub
  8417.  
  8418.   Sub LstModules_Click()
  8419.     Dim text As String
  8420.     text = LstModules.Text
  8421.     If text = ObjectModule.DisplayName Then 
  8422.       module = ObjectModule
  8423.     Else 
  8424.       module = ModuleManager.FindModule(text)
  8425.     End If
  8426.   End Sub
  8427.  
  8428.   Sub LstModules_DblClick()
  8429.     BtnOK_Click
  8430.   End Sub
  8431.  
  8432.   Sub Resize()
  8433.     Dim m, mm, l, t, w, h  as single
  8434.     Dim effWidth as single
  8435.     m = 90 : mm = 180
  8436.     effWidth = IIf(ScaleWidth > 3435, ScaleWidth, 3435)
  8437.     w = BtnOK.Width
  8438.     h = BtnOK.Height
  8439.     l = effWidth - m - w
  8440.     BtnOK.Move(l, m, w, h)
  8441.     BtnCancel.Move(l, BtnOK.Top + h + m, w, h)
  8442.     BtnBrowse.Move(l, ScaleHeight - m - h, w, h)
  8443.     BtnNew.Move(l, BtnBrowse.Top - m - h, w, h)
  8444.     t = LblModules.Top + LblModules.Height + m
  8445.     LstModules.Move(m, t, l - mm, ScaleHeight - m - t)
  8446.   End Sub
  8447.  
  8448. End Type
  8449.  
  8450. Begin Code
  8451. ' Reconstruction commands for object: SampleMasterFormHelpMenu
  8452. '
  8453.   With SampleMasterFormHelpMenu
  8454.  
  8455.     .InsertItem("HelpContents", "&Contents", -1)
  8456.   End With  'SampleMasterFormHelpMenu
  8457. ' Reconstruction commands for object: Envelop
  8458. '
  8459.   With Envelop
  8460.     .ModulePath := "base.ebo;win32.ebo;dialogs.ebo;tools.ebo;database.ebo;dbtools.ebo;options.ebo;envelop.ebo;evhelp.ebo"
  8461.     .MainForm := EnvelopForm
  8462.     .Path := "D:\ENVELOP\PROGRAM\"
  8463.     .EXEName := "ENVELOP"
  8464.     .SplashFileName := "evsplash.bmp"
  8465.     With .Help
  8466.       .FileName := "D:\ENVELOP\PROGRAM\..\help\envelop.hlp"
  8467.       .IsShowing := -1
  8468.     End With  'Envelop.Help
  8469.     With .EBOOpen
  8470.       .FileName := "W:\source\envelop\loadtest.eto"
  8471.       .Filter := "Envelop binary (*.ebo)|*.ebo|Envelop text (*.eto)|*.eto|Envelop temp (ebo*.tmp)|ebo*.tmp|All files (*.*)|*.*|"
  8472.       .FilterIndex := 2
  8473.       .NoChangeDir := False
  8474.     End With  'Envelop.EBOOpen
  8475.     With .ETOOpen
  8476.       .FileName := "D:\envelop\My God, we're caught in quicksand.eto"
  8477.       .Filter := "Envelop text (*.eto)|*.eto|Text files (*.txt)|*.txt|All files (*.*)|*.*|"
  8478.       .FilterIndex := 1
  8479.     End With  'Envelop.ETOOpen
  8480.     With .SADlg
  8481.       .Title := "Save Module As"
  8482.       .FileName := "W:\SOURCE\ENVELOP\envelop.eto"
  8483.       .Filter := "Envelop binary (*.ebo)"
  8484.       .FilterIndex := 2
  8485.       .InitialDir := "D:\envelop\"
  8486.       .NoChangeDir := True
  8487.     End With  'Envelop.SADlg
  8488.   End With  'Envelop
  8489. ' Reconstruction commands for object: ProjectStartupOptionsDialog
  8490. '
  8491.   With ProjectStartupOptionsDialog
  8492.     .Caption := "Startup Options"
  8493.     .Move(3660, 3372, 4956, 2460)
  8494.     .DefaultButton := ProjectStartupOptionsDialog.BtnOK
  8495.     .CancelButton := ProjectStartupOptionsDialog.BtnCancel
  8496.     .MaxButton := False
  8497.     With .BtnOK
  8498.       .Caption := "OK"
  8499.       .ZOrder := 7
  8500.       .Move(3840, 60, 960, 360)
  8501.     End With  'ProjectStartupOptionsDialog.BtnOK
  8502.     With .BtnCancel
  8503.       .Caption := "Cancel"
  8504.       .ZOrder := 8
  8505.       .Move(3840, 480, 960, 360)
  8506.     End With  'ProjectStartupOptionsDialog.BtnCancel
  8507.     With .OptDefaultProj
  8508.       .Caption := "Start with automatic default project"
  8509.       .ZOrder := 2
  8510.       .Move(60, 60, 3720, 300)
  8511.       .TabGroup := True
  8512.     End With  'ProjectStartupOptionsDialog.OptDefaultProj
  8513.     With .OptShowDialog
  8514.       .Caption := "Display project startup dialog"
  8515.       .ZOrder := 3
  8516.       .Move(60, 480, 3720, 300)
  8517.     End With  'ProjectStartupOptionsDialog.OptShowDialog
  8518.     With .OptNewProj
  8519.       .Caption := "Configure new project"
  8520.       .ZOrder := 4
  8521.       .Move(60, 900, 3720, 300)
  8522.     End With  'ProjectStartupOptionsDialog.OptNewProj
  8523.     With .OptOpenProj
  8524.       .Caption := "Browse for existing project"
  8525.       .ZOrder := 5
  8526.       .Move(60, 1320, 3720, 300)
  8527.     End With  'ProjectStartupOptionsDialog.OptOpenProj
  8528.     With .OptNoProj
  8529.       .Caption := "Start with no project"
  8530.       .ZOrder := 6
  8531.       .Move(60, 1740, 3720, 300)
  8532.     End With  'ProjectStartupOptionsDialog.OptNoProj
  8533.   End With  'ProjectStartupOptionsDialog
  8534. ' Reconstruction commands for object: GadgetConfigWizard
  8535. '
  8536.   With GadgetConfigWizard
  8537.     .title_ := "Configure Tool Gadget"
  8538.     .Title := "Configure Tool Gadget"
  8539.     .GraphicFileName := "envelop.ero"
  8540.     .FirstStep := GadgetConfigWizard.ToolName
  8541.     .LastStep := GadgetConfigWizard.ToolBitmap
  8542.     With .ToolName
  8543.       .Caption := "Configure Tool Gadget"
  8544.       .Move(4860, 4770, 7155, 4815)
  8545.       .DefaultButton := GadgetConfigWizard.ToolName.BtnNext
  8546.       .CancelButton := GadgetConfigWizard.ToolName.BtnCancel
  8547.       .wizard := GadgetConfigWizard
  8548.       .NextStep := GadgetConfigWizard.ToolHintText
  8549.       .initialized := -1
  8550.       With .TBName
  8551.         .ZOrder := 1
  8552.         .Move(2850, 1350, 4050, 300)
  8553.       End With  'GadgetConfigWizard.ToolName.TBName
  8554.       With .BtnFinish
  8555.         .ZOrder := 5
  8556.         .Move(6225, 4050, 825, 300)
  8557.       End With  'GadgetConfigWizard.ToolName.BtnFinish
  8558.       With .BtnNext
  8559.         .ZOrder := 4
  8560.         .Move(5325, 4050, 825, 300)
  8561.       End With  'GadgetConfigWizard.ToolName.BtnNext
  8562.       With .BtnBack
  8563.         .Enabled := False
  8564.         .ZOrder := 3
  8565.         .Move(4500, 4050, 825, 300)
  8566.       End With  'GadgetConfigWizard.ToolName.BtnBack
  8567.       With .BtnCancel
  8568.         .ZOrder := 2
  8569.         .Move(3600, 4050, 825, 300)
  8570.       End With  'GadgetConfigWizard.ToolName.BtnCancel
  8571.       With .ImgGraphic
  8572.         .ZOrder := 8
  8573.         .Move(225, 225, 2475, 3150)
  8574.         .Picture := GadgetConfigWizard.Bitmap
  8575.       End With  'GadgetConfigWizard.ToolName.ImgGraphic
  8576.       With .LblInstruction
  8577.         .Caption := "Enter a Name for the ToolGadget."
  8578.         .ZOrder := 7
  8579.         .Move(2850, 300, 4125, 375)
  8580.       End With  'GadgetConfigWizard.ToolName.LblInstruction
  8581.       With .Frame1
  8582.         .ZOrder := 6
  8583.         .Move(75, 3825, 6975, 75)
  8584.       End With  'GadgetConfigWizard.ToolName.Frame1
  8585.     End With  'GadgetConfigWizard.ToolName
  8586.     With .ToolHintText
  8587.       .Caption := "Configure Tool Gadget"
  8588.       .Move(4860, 4770, 7155, 4815)
  8589.       .DefaultButton := GadgetConfigWizard.ToolHintText.BtnNext
  8590.       .CancelButton := Nothing
  8591.       .wizard := GadgetConfigWizard
  8592.       .NextStep := GadgetConfigWizard.ToolBitmap
  8593.       .BackStep := GadgetConfigWizard.ToolName
  8594.       With .TBHintText
  8595.         .ZOrder := 1
  8596.         .Move(2850, 1200, 4050, 600)
  8597.       End With  'GadgetConfigWizard.ToolHintText.TBHintText
  8598.       With .BtnFinish
  8599.         .ZOrder := 5
  8600.         .Move(6225, 4050, 825, 300)
  8601.       End With  'GadgetConfigWizard.ToolHintText.BtnFinish
  8602.       With .BtnNext
  8603.         .ZOrder := 4
  8604.         .Move(5325, 4050, 825, 300)
  8605.       End With  'GadgetConfigWizard.ToolHintText.BtnNext
  8606.       With .BtnBack
  8607.         .ZOrder := 3
  8608.         .Move(4500, 4050, 825, 300)
  8609.       End With  'GadgetConfigWizard.ToolHintText.BtnBack
  8610.       With .BtnCancel
  8611.         .ZOrder := 2
  8612.         .Move(3600, 4050, 825, 300)
  8613.       End With  'GadgetConfigWizard.ToolHintText.BtnCancel
  8614.       With .ImgGraphic
  8615.         .ZOrder := 8
  8616.         .Move(225, 225, 2475, 3150)
  8617.         .Picture := GadgetConfigWizard.Bitmap
  8618.       End With  'GadgetConfigWizard.ToolHintText.ImgGraphic
  8619.       With .LblInstruction
  8620.         .Caption := "Enter a HintText for the ToolGadget."
  8621.         .ZOrder := 7
  8622.         .Move(2850, 300, 4125, 300)
  8623.       End With  'GadgetConfigWizard.ToolHintText.LblInstruction
  8624.       With .Frame1
  8625.         .ZOrder := 6
  8626.         .Move(75, 3825, 6975, 75)
  8627.       End With  'GadgetConfigWizard.ToolHintText.Frame1
  8628.     End With  'GadgetConfigWizard.ToolHintText
  8629.     With .ToolBitmap
  8630.       .Caption := "Configure Tool Gadget"
  8631.       .Move(4860, 4770, 7155, 4815)
  8632.       .DefaultButton := GadgetConfigWizard.ToolBitmap.BtnFinish
  8633.       .CancelButton := Nothing
  8634.       .wizard := GadgetConfigWizard
  8635.       .BackStep := GadgetConfigWizard.ToolHintText
  8636.       With .LblBitmap
  8637.         .Caption := "Picture file:"
  8638.         .ZOrder := 5
  8639.         .Move(2850, 825, 1500, 225)
  8640.       End With  'GadgetConfigWizard.ToolBitmap.LblBitmap
  8641.       With .TBBitmap
  8642.         .Caption := "TBBitmap"
  8643.         .ZOrder := 4
  8644.         .Move(2850, 1125, 4050, 450)
  8645.       End With  'GadgetConfigWizard.ToolBitmap.TBBitmap
  8646.       With .BTNBrowse
  8647.         .Caption := "Browse..."
  8648.         .ZOrder := 3
  8649.         .Move(2850, 1725, 1050, 375)
  8650.       End With  'GadgetConfigWizard.ToolBitmap.BTNBrowse
  8651.       With .SampleBox
  8652.         .Caption := "SampleBox"
  8653.         .ZOrder := 2
  8654.         .Move(4785, 2835, 240, 240)
  8655.         .Visible := True
  8656.         With .PreviewTool
  8657.           .Position := 1
  8658.           .HintText := "New Object"
  8659.           With .bitmap
  8660.             .FileName := "envelop.ero"
  8661.             .ResId := 0
  8662.           End With  'GadgetConfigWizard.ToolBitmap.SampleBox.PreviewTool.bitmap
  8663.         End With  'GadgetConfigWizard.ToolBitmap.SampleBox.PreviewTool
  8664.       End With  'GadgetConfigWizard.ToolBitmap.SampleBox
  8665.       With .BTNPreview
  8666.         .Caption := "Preview"
  8667.         .ZOrder := 1
  8668.         .Move(5625, 1725, 1200, 375)
  8669.       End With  'GadgetConfigWizard.ToolBitmap.BTNPreview
  8670.       With .BtnFinish
  8671.         .ZOrder := 9
  8672.         .Move(6225, 4050, 825, 300)
  8673.       End With  'GadgetConfigWizard.ToolBitmap.BtnFinish
  8674.       With .BtnNext
  8675.         .Enabled := False
  8676.         .ZOrder := 8
  8677.         .Move(5325, 4050, 825, 300)
  8678.       End With  'GadgetConfigWizard.ToolBitmap.BtnNext
  8679.       With .BtnBack
  8680.         .ZOrder := 7
  8681.         .Move(4500, 4050, 825, 300)
  8682.       End With  'GadgetConfigWizard.ToolBitmap.BtnBack
  8683.       With .BtnCancel
  8684.         .ZOrder := 6
  8685.         .Move(3600, 4050, 825, 300)
  8686.       End With  'GadgetConfigWizard.ToolBitmap.BtnCancel
  8687.       With .ImgGraphic
  8688.         .ZOrder := 12
  8689.         .Move(225, 225, 2475, 3150)
  8690.         .Picture := GadgetConfigWizard.Bitmap
  8691.       End With  'GadgetConfigWizard.ToolBitmap.ImgGraphic
  8692.       With .LblInstruction
  8693.         .Caption := "Type a FileName for the bitmap or the ToolGadget, or press Browse..."
  8694.         .ZOrder := 11
  8695.         .Move(2850, 300, 4125, 450)
  8696.       End With  'GadgetConfigWizard.ToolBitmap.LblInstruction
  8697.       With .Frame1
  8698.         .ZOrder := 10
  8699.         .Move(75, 3825, 6975, 75)
  8700.       End With  'GadgetConfigWizard.ToolBitmap.Frame1
  8701.     End With  'GadgetConfigWizard.ToolBitmap
  8702.     With .TempGadget
  8703.       .HintText := "New Object"
  8704.       .PsuedoName := "NewObject"
  8705.       With .bitmap
  8706.         .FileName := "envelop.ero"
  8707.         .ResId := 244
  8708.       End With  'GadgetConfigWizard.TempGadget.bitmap
  8709.     End With  'GadgetConfigWizard.TempGadget
  8710.     With .BlankBitmap
  8711.       .LoadType := "MemoryBased"
  8712.       .FileName := "envelop.ero"
  8713.       .ResId := 488
  8714.     End With  'GadgetConfigWizard.BlankBitmap
  8715.     With .Bitmap
  8716.       .LoadType := "MemoryBased"
  8717.       .FileName := "envelop.ero"
  8718.       .ResId := 880
  8719.     End With  'GadgetConfigWizard.Bitmap
  8720.   End With  'GadgetConfigWizard
  8721. ' Reconstruction commands for object: ObjectEditor
  8722. '
  8723.   With ObjectEditor
  8724.     .Enabled := True
  8725.   End With  'ObjectEditor
  8726. ' Reconstruction commands for object: MethodEditor
  8727. '
  8728.   With MethodEditor
  8729.     .AnimateDelay := 100
  8730.     .HighlightSyntax := True
  8731.     .BackColor := 16777215
  8732.     .ForeColor := 0
  8733.     .ColorNextStmtFG := 16777215
  8734.     .ColorNextStmtBG := 32768
  8735.     .ColorEnabledBreakFG := 16777215
  8736.     .ColorEnabledBreakBG := 255
  8737.     .ColorDisabledBreakFG := 16777215
  8738.     .ColorDisabledBreakBG := 128
  8739.     .ColorCommentFG := 32768
  8740.     .ColorCommentBG := -1
  8741.     .ColorKeywordFG := 8388608
  8742.     .ColorKeywordBG := -1
  8743.     .ColorIdentifierFG := -1
  8744.     .ColorIdentifierBG := -1
  8745.     .ColorStringFG := -1
  8746.     .ColorStringBG := -1
  8747.     .ColorIntegerFG := -1
  8748.     .ColorIntegerBG := -1
  8749.     .ColorFloatFG := -1
  8750.     .ColorFloatBG := -1
  8751.     .ColorOctalFG := -1
  8752.     .ColorOctalBG := -1
  8753.     .ColorHexFG := -1
  8754.     .ColorHexBG := -1
  8755.     .ColorOperatorFG := -1
  8756.     .ColorOperatorBG := -1
  8757.   End With  'MethodEditor
  8758. ' Reconstruction commands for object: ObjectEditorMgr
  8759. '
  8760.   With ObjectEditorMgr
  8761.     .UndoLimit := 5
  8762.     .RedoLimit := 5
  8763.   End With  'ObjectEditorMgr
  8764. ' Reconstruction commands for object: SamplesBrowser
  8765. '
  8766.   With SamplesBrowser
  8767.     .Caption := "Samples Browser"
  8768.     .Font := EnvelopFont
  8769.     .Move(4065, 1815, 6570, 6720)
  8770.     .AccelForm := EnvelopForm
  8771.     .CurrentSampleModule := Nothing
  8772.     .CurrentSecondModule := Nothing
  8773.     .DirBasicTraining := "W:\BIN\..\bootcamp\basic"
  8774.     .DirAdvancedTraining := "W:\BIN\..\bootcamp\advanced"
  8775.     .DirConceptsTraining := "W:\BIN\..\bootcamp\concepts"
  8776.     .DirComponents := "W:\BIN\..\arsenal\parts"
  8777.     .DirApplications := "W:\BIN\..\arsenal\apps"
  8778.     .DirTools := "W:\BIN\..\arsenal\tools"
  8779.     .ScanCategory := ""
  8780.     .initializing := 0
  8781.     .PopulateMasterListPunchOut := 0
  8782.     With .ChkBasicTraining
  8783.       .Caption := "Basic Training"
  8784.       .ZOrder := 2
  8785.       .Move(2250, 150, 1980, 225)
  8786.     End With  'SamplesBrowser.ChkBasicTraining
  8787.     With .ChkAdvancedTraining
  8788.       .Caption := "Advanced Training"
  8789.       .ZOrder := 3
  8790.       .Move(2250, 450, 1980, 225)
  8791.     End With  'SamplesBrowser.ChkAdvancedTraining
  8792.     With .ChkConceptsTraining
  8793.       .Caption := "Concepts Training"
  8794.       .ZOrder := 4
  8795.       .Move(2250, 750, 1980, 165)
  8796.     End With  'SamplesBrowser.ChkConceptsTraining
  8797.     With .ChkComponents
  8798.       .Caption := "Components"
  8799.       .ZOrder := 5
  8800.       .Move(4650, 150, 1500, 225)
  8801.     End With  'SamplesBrowser.ChkComponents
  8802.     With .ChkApplications
  8803.       .Caption := "Applications"
  8804.       .ZOrder := 6
  8805.       .Move(4650, 450, 1500, 225)
  8806.     End With  'SamplesBrowser.ChkApplications
  8807.     With .ChkTools
  8808.       .Caption := "Tools"
  8809.       .ZOrder := 7
  8810.       .Move(4650, 750, 1500, 165)
  8811.     End With  'SamplesBrowser.ChkTools
  8812.     With .ChkKeywordSearch
  8813.       .Caption := "Search by keyword"
  8814.       .ZOrder := 8
  8815.       .Move(150, 1050, 2385, 300)
  8816.     End With  'SamplesBrowser.ChkKeywordSearch
  8817.     With .Label1
  8818.       .Caption := "Type a word, or select one from the list. Then choose Show Topics."
  8819.       .ForeColor := 16711680
  8820.       .ZOrder := 9
  8821.       .Move(705, 1425, 3960, 450)
  8822.     End With  'SamplesBrowser.Label1
  8823.     With .TxtKeySearch
  8824.       .Enabled := False
  8825.       .ZOrder := 10
  8826.       .Move(735, 1980, 3885, 345)
  8827.     End With  'SamplesBrowser.TxtKeySearch
  8828.     With .BtnShowTopics
  8829.       .Caption := "Show Topics"
  8830.       .Enabled := False
  8831.       .ZOrder := 11
  8832.       .Move(4950, 1950, 1350, 345)
  8833.     End With  'SamplesBrowser.BtnShowTopics
  8834.     With .LstKeywords
  8835.       .Caption := "LstKeywords"
  8836.       .Enabled := False
  8837.       .ZOrder := 12
  8838.       .Move(900, 2400, 5400, 1200)
  8839.     End With  'SamplesBrowser.LstKeywords
  8840.     With .Label2
  8841.       .Caption := "Select topic then choose Load Sample or Help."
  8842.       .ForeColor := 16711680
  8843.       .ZOrder := 13
  8844.       .Move(150, 3960, 4575, 270)
  8845.     End With  'SamplesBrowser.Label2
  8846.     With .BtnLoadSample
  8847.       .Caption := "Load Sample"
  8848.       .ZOrder := 14
  8849.       .Move(4950, 3900, 1380, 345)
  8850.     End With  'SamplesBrowser.BtnLoadSample
  8851.     With .BtnHelp
  8852.       .Caption := "Help"
  8853.       .Enabled := False
  8854.       .ZOrder := 15
  8855.       .Move(4950, 4350, 1380, 345)
  8856.     End With  'SamplesBrowser.BtnHelp
  8857.     With .LstTopics
  8858.       .Caption := "LstTopics"
  8859.       .ZOrder := 16
  8860.       .Move(150, 4770, 6150, 1200)
  8861.     End With  'SamplesBrowser.LstTopics
  8862.     With .LstSearchMaster
  8863.       .ZOrder := 17
  8864.       .Move(0, 0, 30, 30)
  8865.       .Visible := False
  8866.     End With  'SamplesBrowser.LstSearchMaster
  8867.     With .LstSampleNameIndex
  8868.       .ZOrder := 18
  8869.       .Move(0, 0, 705, 30)
  8870.       .Visible := False
  8871.     End With  'SamplesBrowser.LstSampleNameIndex
  8872.     With .LblTopics
  8873.       .Caption := "<category>:<sample>"
  8874.       .ZOrder := 19
  8875.       .Move(150, 4455, 3900, 240)
  8876.     End With  'SamplesBrowser.LblTopics
  8877.     With .helpfile
  8878.     End With  'SamplesBrowser.helpfile
  8879.     With .BtnUpdate
  8880.       .Caption := "Update"
  8881.       .Enabled := False
  8882.       .ZOrder := 1
  8883.       .Move(150, 150, 1350, 345)
  8884.     End With  'SamplesBrowser.BtnUpdate
  8885.   End With  'SamplesBrowser
  8886. ' Reconstruction commands for object: MenuSelector
  8887. '
  8888.   With MenuSelector
  8889.     .Caption := "Select Menu"
  8890.     .Font := DefaultDialogFont
  8891.     .Move(5160, 2295, 5340, 2295)
  8892.     .DefaultButton := MenuSelector.btnOK
  8893.     With .Label1
  8894.       .Caption := "Select the menu or menubar to modify"
  8895.       .ZOrder := 7
  8896.       .Move(150, 150, 4050, 300)
  8897.     End With  'MenuSelector.Label1
  8898.     With .btnOK
  8899.       .Caption := "OK"
  8900.       .ZOrder := 6
  8901.       .Move(4260, 150, 900, 345)
  8902.     End With  'MenuSelector.btnOK
  8903.     With .btnCancel
  8904.       .Caption := "Cancel"
  8905.       .ZOrder := 5
  8906.       .Move(4260, 600, 900, 345)
  8907.     End With  'MenuSelector.btnCancel
  8908.     With .Label2
  8909.       .Caption := "Menu Type:"
  8910.       .ZOrder := 4
  8911.       .Move(150, 600, 1050, 300)
  8912.     End With  'MenuSelector.Label2
  8913.     With .optMbar
  8914.       .Caption := "Menubar"
  8915.       .ZOrder := 2
  8916.       .Move(1350, 600, 1800, 300)
  8917.       .TabStop := True
  8918.     End With  'MenuSelector.optMbar
  8919.     With .optPopup
  8920.       .Caption := "Popup"
  8921.       .ZOrder := 3
  8922.       .Move(1350, 975, 1800, 300)
  8923.     End With  'MenuSelector.optPopup
  8924.     With .cboMenus
  8925.       .ZOrder := 1
  8926.       .Move(150, 1425, 4920, 315)
  8927.       .ShowEmbeds := True
  8928.     End With  'MenuSelector.cboMenus
  8929.   End With  'MenuSelector
  8930. ' Reconstruction commands for object: EnvelopFont
  8931. '
  8932.   With EnvelopFont
  8933.     .FaceName := "MS Sans Serif"
  8934.     .Size := 8.000000
  8935.     .Bold := True
  8936.     .Italic := False
  8937.     .Strikethru := False
  8938.   End With  'EnvelopFont
  8939. ' Reconstruction commands for object: ProjectAndModuleView
  8940. '
  8941.   With ProjectAndModuleView
  8942.     .BackColor := 12632256
  8943.     .DragMode := "LeftMouse"
  8944.     .Move(-15, 376, 3570, 6165)
  8945.     .Visible := False
  8946.     .IconBitmap := ProjectAndModuleView.bitmap
  8947.     .kIconProject := 0
  8948.     .kIconModule := 4
  8949.     .kIconObject := 8
  8950.     .kLevelProject := 0
  8951.     .kLevelModule := 0
  8952.     .kLevelObject := 0
  8953.     With .bitmap
  8954.       .LoadType := "MemoryBased"
  8955.       .FileName := "envelop.ero"
  8956.       .ResId := 2588
  8957.     End With  'ProjectAndModuleView.bitmap
  8958.   End With  'ProjectAndModuleView
  8959. ' Reconstruction commands for object: Debug
  8960. '
  8961.   With Debug
  8962.   End With  'Debug
  8963. ' Reconstruction commands for object: SourceIterator
  8964. '
  8965.   With SourceIterator
  8966.     .CurObject := Nothing
  8967.     .CurMethod := ""
  8968.     .HitStart := -1
  8969.     .SearchPattern := ""
  8970.   End With  'SourceIterator
  8971. ' Reconstruction commands for object: ApplicationEditor
  8972. '
  8973.   With ApplicationEditor
  8974.     With .form
  8975.       .Caption := "Application: Application1"
  8976.       .Font := EnvelopFont
  8977.       .Move(3735, 3480, 5550, 3495)
  8978.       .KeyPreview := True
  8979.       .AccelForm := EnvelopForm
  8980.       With .LblApp
  8981.         .Caption := "Application:"
  8982.         .ZOrder := 2
  8983.         .Move(60, 105, 1095, 270)
  8984.         .Alignment := "Right"
  8985.       End With  'ApplicationEditor.form.LblApp
  8986.       With .CBApps
  8987.         .ZOrder := 3
  8988.         .Move(1215, 60, 2250, 300)
  8989.         .RootObject := Application
  8990.         .Style := "Tree"
  8991.       End With  'ApplicationEditor.form.CBApps
  8992.       With .BtnNewApp
  8993.         .Caption := "&New Application..."
  8994.         .ZOrder := 4
  8995.         .Move(3585, 45, 1785, 330)
  8996.       End With  'ApplicationEditor.form.BtnNewApp
  8997.       With .LblMainForm
  8998.         .Caption := "Main form:"
  8999.         .ZOrder := 5
  9000.         .Move(60, 465, 1095, 270)
  9001.         .Alignment := "Right"
  9002.       End With  'ApplicationEditor.form.LblMainForm
  9003.       With .CBForms
  9004.         .ZOrder := 6
  9005.         .Move(1215, 420, 2250, 300)
  9006.         .RootObject := Form
  9007.         .Style := "Tree"
  9008.       End With  'ApplicationEditor.form.CBForms
  9009.       With .LblEXE
  9010.         .Caption := "EXE file:"
  9011.         .ZOrder := 7
  9012.         .Move(60, 855, 1095, 270)
  9013.         .Alignment := "Right"
  9014.       End With  'ApplicationEditor.form.LblEXE
  9015.       With .TEEXE
  9016.         .ZOrder := 8
  9017.         .Move(1215, 810, 2250, 300)
  9018.       End With  'ApplicationEditor.form.TEEXE
  9019.       With .BtnBrowseEXE
  9020.         .Caption := "Browse EXE..."
  9021.         .ZOrder := 9
  9022.         .Move(3585, 795, 1785, 330)
  9023.       End With  'ApplicationEditor.form.BtnBrowseEXE
  9024.       With .LblSplash
  9025.         .Caption := "Splash file:"
  9026.         .ZOrder := 10
  9027.         .Move(60, 1245, 1095, 270)
  9028.         .Alignment := "Right"
  9029.       End With  'ApplicationEditor.form.LblSplash
  9030.       With .TESplash
  9031.         .ZOrder := 11
  9032.         .Move(1215, 1200, 2250, 300)
  9033.       End With  'ApplicationEditor.form.TESplash
  9034.       With .BtnBrowseSplash
  9035.         .Caption := "Browse splash..."
  9036.         .ZOrder := 12
  9037.         .Move(3585, 1185, 1785, 330)
  9038.       End With  'ApplicationEditor.form.BtnBrowseSplash
  9039.       With .LblModules
  9040.         .Caption := "Modules:"
  9041.         .ZOrder := 13
  9042.         .Move(60, 1620, 1095, 270)
  9043.         .Alignment := "Right"
  9044.       End With  'ApplicationEditor.form.LblModules
  9045.       With .LstModules
  9046.         .ZOrder := 14
  9047.         .Move(1215, 1620, 2250, 1395)
  9048.         .Sorted := False
  9049.       End With  'ApplicationEditor.form.LstModules
  9050.       With .BtnWriteEXE
  9051.         .Caption := "Write EXE"
  9052.         .ZOrder := 15
  9053.         .Move(3585, 2700, 1785, 330)
  9054.       End With  'ApplicationEditor.form.BtnWriteEXE
  9055.       With .ChkNoMainForm
  9056.         .Caption := "No main form"
  9057.         .ZOrder := 16
  9058.         .Move(3585, 435, 1800, 300)
  9059.       End With  'ApplicationEditor.form.ChkNoMainForm
  9060.       With .BtnAddModule
  9061.         .Caption := "Add module..."
  9062.         .ZOrder := 17
  9063.         .Move(3585, 1590, 1785, 330)
  9064.       End With  'ApplicationEditor.form.BtnAddModule
  9065.       With .BtnDelModule
  9066.         .Caption := "Remove module..."
  9067.         .ZOrder := 1
  9068.         .Move(3585, 1980, 1785, 330)
  9069.       End With  'ApplicationEditor.form.BtnDelModule
  9070.     End With  'ApplicationEditor.form
  9071.   End With  'ApplicationEditor
  9072. ' Reconstruction commands for object: EnvelopScreenLayout
  9073. '
  9074.   With EnvelopScreenLayout
  9075.   End With  'EnvelopScreenLayout
  9076. ' Reconstruction commands for object: WinDebug
  9077. '
  9078.   With WinDebug
  9079.     .Window := Nothing
  9080.   End With  'WinDebug
  9081. ' Reconstruction commands for object: ObjectViewer
  9082. '
  9083.   With ObjectViewer
  9084.     .Caption := "Objects"
  9085.     .Font := EnvelopFont
  9086.     .Move(10665, 1815, 3660, 4380)
  9087.     .AccelForm := EnvelopForm
  9088.     With .ProjectView
  9089.       .ZOrder := 5
  9090.       .Move(-30, 375, 3570, 3615)
  9091.       .Visible := True
  9092.       .ExpandOnDblClick := True
  9093.       .IconBitmap := ObjectViewer.ProjectView.bitmap
  9094.       .IconHeight := 12
  9095.       .IconWidth := 20
  9096.       .IndentWidth := 12
  9097.       .kLevelModule := 1
  9098.       .kLevelObject := 2
  9099.       With .bitmap
  9100.         .ResId := 5104
  9101.       End With  'ObjectViewer.ProjectView.bitmap
  9102.     End With  'ObjectViewer.ProjectView
  9103.     With .HierView
  9104.       .BackColor := 12632256
  9105.       .DragMode := "LeftMouse"
  9106.       .ZOrder := 1
  9107.       .Move(-30, 375, 3570, 3615)
  9108.       .Visible := False
  9109.       .dirty := True
  9110.     End With  'ObjectViewer.HierView
  9111.     With .ModuleView
  9112.       .ZOrder := 2
  9113.       .Move(-30, 375, 3570, 3615)
  9114.       .ExpandOnDblClick := True
  9115.       .IconBitmap := ObjectViewer.ModuleView.bitmap
  9116.       .IconHeight := 12
  9117.       .IconWidth := 20
  9118.       .IndentWidth := 12
  9119.       .kLevelProject := -1
  9120.       .kLevelObject := 1
  9121.       With .bitmap
  9122.         .ResId := 7620
  9123.       End With  'ObjectViewer.ModuleView.bitmap
  9124.     End With  'ObjectViewer.ModuleView
  9125.     With .AlphaView
  9126.       .BackColor := 12632256
  9127.       .DragMode := "LeftMouse"
  9128.       .ZOrder := 4
  9129.       .Move(-30, 375, 3570, 3615)
  9130.       .Visible := False
  9131.       .ListIndex := 1
  9132.       .SelObject := AboutEnvelopForm
  9133.     End With  'ObjectViewer.AlphaView
  9134.     With .toolbar
  9135.       .ZOrder := 3
  9136.       .Move(-30, -30, 3570, 405)
  9137.       .LayoutStyle := "ToolBar"
  9138.       .MarginLeft := 5
  9139.       .Visible := True
  9140.       With .ViewProject
  9141.         .Position := 1
  9142.         .State := "Down"
  9143.         .ButtonType := "Exclusive"
  9144.         .HintText := "Project view"
  9145.         With .bitmap
  9146.           .FileName := "envelop.ero"
  9147.           .ResId := 10136
  9148.         End With  'ObjectViewer.toolbar.ViewProject.bitmap
  9149.       End With  'ObjectViewer.toolbar.ViewProject
  9150.       With .ViewModule
  9151.         .Position := 2
  9152.         .ButtonType := "Exclusive"
  9153.         .HintText := "Module view"
  9154.         With .bitmap
  9155.           .FileName := "envelop.ero"
  9156.           .ResId := 10380
  9157.         End With  'ObjectViewer.toolbar.ViewModule.bitmap
  9158.       End With  'ObjectViewer.toolbar.ViewModule
  9159.       With .ViewAlphabetical
  9160.         .Position := 3
  9161.         .ButtonType := "Exclusive"
  9162.         .HintText := "Objects: alphabetic view"
  9163.         With .bitmap
  9164.           .FileName := "envelop.ero"
  9165.           .ResId := 10624
  9166.         End With  'ObjectViewer.toolbar.ViewAlphabetical.bitmap
  9167.       End With  'ObjectViewer.toolbar.ViewAlphabetical
  9168.       With .ViewHierarchical
  9169.         .Separator := 10
  9170.         .Position := 4
  9171.         .ButtonType := "Exclusive"
  9172.         .HintText := "Objects: inheritance view"
  9173.         With .bitmap
  9174.           .FileName := "envelop.ero"
  9175.           .ResId := 10868
  9176.         End With  'ObjectViewer.toolbar.ViewHierarchical.bitmap
  9177.       End With  'ObjectViewer.toolbar.ViewHierarchical
  9178.       With .MakeCurrent
  9179.         .Separator := 11
  9180.         .Position := 5
  9181.         .HintText := "Make selected project/module current"
  9182.         With .bitmap
  9183.           .FileName := "envelop.ero"
  9184.           .ResId := 11112
  9185.         End With  'ObjectViewer.toolbar.MakeCurrent.bitmap
  9186.       End With  'ObjectViewer.toolbar.MakeCurrent
  9187.       With .AddModule
  9188.         .Position := 6
  9189.         .HintText := "Add module to project: Application1"
  9190.         With .bitmap
  9191.           .FileName := "envelop.ero"
  9192.           .ResId := 11356
  9193.         End With  'ObjectViewer.toolbar.AddModule.bitmap
  9194.       End With  'ObjectViewer.toolbar.AddModule
  9195.       With .NewModule
  9196.         .Position := 7
  9197.         .HintText := "New module"
  9198.         With .bitmap
  9199.           .FileName := "envelop.ero"
  9200.           .ResId := 11600
  9201.         End With  'ObjectViewer.toolbar.NewModule.bitmap
  9202.       End With  'ObjectViewer.toolbar.NewModule
  9203.       With .LoadModule
  9204.         .Position := 8
  9205.         .HintText := "Load module"
  9206.         With .bitmap
  9207.           .FileName := "envelop.ero"
  9208.           .ResId := 11844
  9209.         End With  'ObjectViewer.toolbar.LoadModule.bitmap
  9210.       End With  'ObjectViewer.toolbar.LoadModule
  9211.       With .SaveModule
  9212.         .Position := 9
  9213.         .HintText := "Save module: envelop.ebo"
  9214.         With .bitmap
  9215.           .FileName := "envelop.ero"
  9216.           .ResId := 12088
  9217.         End With  'ObjectViewer.toolbar.SaveModule.bitmap
  9218.       End With  'ObjectViewer.toolbar.SaveModule
  9219.       With .UnloadModule
  9220.         .Enabled := False
  9221.         .Position := 10
  9222.         .HintText := "Unload module"
  9223.         With .bitmap
  9224.           .FileName := "envelop.ero"
  9225.           .ResId := 12332
  9226.         End With  'ObjectViewer.toolbar.UnloadModule.bitmap
  9227.       End With  'ObjectViewer.toolbar.UnloadModule
  9228.     End With  'ObjectViewer.toolbar
  9229.     With .ObjectEditorHook
  9230.     End With  'ObjectViewer.ObjectEditorHook
  9231.   End With  'ObjectViewer
  9232. ' Reconstruction commands for object: SourceSearcher
  9233. '
  9234.   With SourceSearcher
  9235.     .Caption := "Source Searcher"
  9236.     .Font := EnvelopFont
  9237.     .Move(7080, 1125, 8085, 6525)
  9238.     .KeyPreview := True
  9239.     .DefaultButton := SourceSearcher.Search
  9240.     .AccelForm := EnvelopForm
  9241.     .MaxEntries := 5
  9242.     .SearchModule := Nothing
  9243.     With .Search
  9244.       .Caption := "Search"
  9245.       .ZOrder := 1
  9246.       .Move(75, 1350, 900, 300)
  9247.     End With  'SourceSearcher.Search
  9248.     With .ModuleCombo
  9249.       .ZOrder := 2
  9250.       .Move(75, 375, 5475, 300)
  9251.       .Sorted := False
  9252.       .Style := "DropdownList"
  9253.     End With  'SourceSearcher.ModuleCombo
  9254.     With .Label3
  9255.       .Caption := "Use objects from Module:"
  9256.       .ZOrder := 3
  9257.       .Move(75, 75, 2625, 300)
  9258.     End With  'SourceSearcher.Label3
  9259.     With .SearchCombo
  9260.       .ZOrder := 4
  9261.       .Move(75, 900, 5475, 300)
  9262.       .Sorted := False
  9263.     End With  'SourceSearcher.SearchCombo
  9264.     With .HitResults
  9265.       .Caption := "HitResults"
  9266.       .BackColor := 12632256
  9267.       .ZOrder := 5
  9268.       .Move(45, 1665, 7875, 4410)
  9269.       .IconBitmap := SourceSearcher.bitmap
  9270.       .IconHeight := 12
  9271.       .IconWidth := 12
  9272.       .Sorted := True
  9273.     End With  'SourceSearcher.HitResults
  9274.     With .bitmap
  9275.       .LoadType := "MemoryBased"
  9276.       .FileName := "envelop.ero"
  9277.       .ResId := 12576
  9278.     End With  'SourceSearcher.bitmap
  9279.     With .ObjectsBtn
  9280.       .Caption := "Objects"
  9281.       .ZOrder := 6
  9282.       .Move(4650, 1350, 900, 300)
  9283.     End With  'SourceSearcher.ObjectsBtn
  9284.     With .HitFilter
  9285.       .Caption := "Only show hits"
  9286.       .ZOrder := 7
  9287.       .Move(1050, 1350, 1800, 300)
  9288.     End With  'SourceSearcher.HitFilter
  9289.     With .AutoExpand
  9290.       .Caption := "Auto Expand"
  9291.       .ZOrder := 8
  9292.       .Move(2925, 1350, 1575, 300)
  9293.     End With  'SourceSearcher.AutoExpand
  9294.     With .Help
  9295.       .Caption := "Help"
  9296.       .ZOrder := 9
  9297.       .Move(5700, 1350, 750, 300)
  9298.     End With  'SourceSearcher.Help
  9299.     With .searchGroup
  9300.       .Persistent := False
  9301.     End With  'SourceSearcher.searchGroup
  9302.     With .ListObject
  9303.       .obj := Nothing
  9304.     End With  'SourceSearcher.ListObject
  9305.     With .ListMethod
  9306.       .meth := ""
  9307.     End With  'SourceSearcher.ListMethod
  9308.     With .ListHit
  9309.       .hitStart := 0
  9310.       .hitLength := 0
  9311.     End With  'SourceSearcher.ListHit
  9312.     With .ResetCurObject
  9313.     End With  'SourceSearcher.ResetCurObject
  9314.   End With  'SourceSearcher
  9315. ' Reconstruction commands for object: ObjectBoxEditor
  9316. '
  9317.   With ObjectBoxEditor
  9318.     With .ObjBoxForm
  9319.       .Caption := "Editing: toolbar"
  9320.       .ForeColor := 0
  9321.       .Font := EnvelopFont
  9322.       .Move(1005, 1785, 7755, 840)
  9323.       .KeyPreview := True
  9324.       .MaxButton := False
  9325.       .MinButton := False
  9326.       With .Toolbox
  9327.         .ZOrder := 2
  9328.         .Move(0, 0, 4065, 420)
  9329.         .NumColumns := 10
  9330.         .LayoutStyle := "ToolBar"
  9331.         .Visible := True
  9332.         .EditOnAdd = True
  9333.         .GadgetPrototype = ToolGadget
  9334.         With .MovePrevious
  9335.           .Position := 1
  9336.           .HintText := "Previous Gadget"
  9337.           With .bitmap
  9338.             .FileName := "envelop.ero"
  9339.             .ResId := 12932
  9340.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.MovePrevious.bitmap
  9341.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.MovePrevious
  9342.         With .MoveNext
  9343.           .Position := 2
  9344.           .HintText := "Next Gadget"
  9345.           With .bitmap
  9346.             .FileName := "envelop.ero"
  9347.             .ResId := 13324
  9348.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.MoveNext.bitmap
  9349.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.MoveNext
  9350.         With .NewGadget
  9351.           .Position := 3
  9352.           .HintText := "Embed New Gadget"
  9353.           With .bitmap
  9354.             .FileName := "envelop.ero"
  9355.             .ResId := 13716
  9356.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.NewGadget.bitmap
  9357.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.NewGadget
  9358.         With .DelGadget
  9359.           .Position := 4
  9360.           With .bitmap
  9361.             .FileName := "envelop.ero"
  9362.             .ResId := 14108
  9363.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.DelGadget.bitmap
  9364.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.DelGadget
  9365.         With .Configure
  9366.           .Position := 5
  9367.           With .bitmap
  9368.             .FileName := "envelop.ero"
  9369.             .ResId := 14500
  9370.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.Configure.bitmap
  9371.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.Configure
  9372.         With .ConfigureTool
  9373.           .Position := 6
  9374.           With .bitmap
  9375.             .FileName := "envelop.ero"
  9376.             .ResId := 14892
  9377.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.ConfigureTool.bitmap
  9378.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.ConfigureTool
  9379.         With .SlidePrevious
  9380.           .Position := 7
  9381.           .HintText := "Slide Gadget Position Back"
  9382.           With .bitmap
  9383.             .FileName := "envelop.ero"
  9384.             .ResId := 15284
  9385.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SlidePrevious.bitmap
  9386.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SlidePrevious
  9387.         With .SlideNext
  9388.           .Position := 8
  9389.           .HintText := "Slide Gadget Position Forward"
  9390.           With .bitmap
  9391.             .FileName := "envelop.ero"
  9392.             .ResId := 15676
  9393.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SlideNext.bitmap
  9394.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SlideNext
  9395.         With .SeparatorInc
  9396.           .Position := 9
  9397.           .HintText := "Increase Separator"
  9398.           With .bitmap
  9399.             .FileName := "envelop.ero"
  9400.             .ResId := 16068
  9401.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SeparatorInc.bitmap
  9402.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SeparatorInc
  9403.         With .SeparatorDec
  9404.           .Position := 10
  9405.           .HintText := "Decrease Separator"
  9406.           With .bitmap
  9407.             .FileName := "envelop.ero"
  9408.             .ResId := 16460
  9409.           End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SeparatorDec.bitmap
  9410.         End With  'ObjectBoxEditor.ObjBoxForm.Toolbox.SeparatorDec
  9411.       End With  'ObjectBoxEditor.ObjBoxForm.Toolbox
  9412.       With .CBGadget
  9413.         .ZOrder := 1
  9414.         .Move(4200, 75, 3135, 315)
  9415.         .Sorted := False
  9416.         .SuppressClick := False
  9417.       End With  'ObjectBoxEditor.ObjBoxForm.CBGadget
  9418.     End With  'ObjectBoxEditor.ObjBoxForm
  9419.   End With  'ObjectBoxEditor
  9420. ' Reconstruction commands for object: MenuEditHook
  9421. '
  9422.   With MenuEditHook
  9423.   End With  'MenuEditHook
  9424. ' Reconstruction commands for object: EnvelopForm
  9425. '
  9426.   With EnvelopForm
  9427.     .Caption := "Envelop"
  9428.     .Move(15, 15, 15330, 1125)
  9429.     .Outlined := True
  9430.     .KeyPreview := True
  9431.     .MenuBar := EnvelopForm.EnvelopMenus
  9432.     .FileDrop := True
  9433.     .MaxButton := False
  9434.     With .EnvelopMenus
  9435.  
  9436.       .InsertPopup(EnvelopForm.EnvelopMenus.EnvelopFileMenu, "&File", -1)
  9437.       .InsertPopup(EnvelopForm.EnvelopMenus.EnvelopObjectMenu, "&Object", -1)
  9438.       .InsertPopup(EnvelopForm.EnvelopMenus.EnvelopOptionsMenu, "O&ptions", -1)
  9439.       .InsertPopup(EnvelopForm.EnvelopMenus.EnvelopToolsMenu, "&Tools", -1)
  9440.       .InsertPopup(EnvelopForm.EnvelopMenus.EnvelopHelpMenu, "&Help", -1)
  9441.       With .EnvelopFileMenu
  9442.  
  9443.         .InsertItem("NewProject", "New Project", -1)
  9444.         .InsertItem("OpenProject", "Open Project", -1)
  9445.         .InsertSeparator(-1)
  9446.         .InsertItem("SaveProject", "Save Project", -1)
  9447.         .InsertItem("SaveProjectAs", "Save Project As...", -1)
  9448.         .InsertItem("CloseProject", "Close Project", -1)
  9449.         .InsertSeparator(-1)
  9450.         .InsertItem("NewModule", "&New Module", -1)
  9451.         .InsertItem("LoadModule", "&Load Module", -1)
  9452.         .InsertItem("MergeModule", "&Merge Module...", -1)
  9453.         .InsertSeparator(-1)
  9454.         .InsertItem("SaveModule", "&Save Module", -1)
  9455.         .AccelKey = "Ctrl+S"
  9456.         .SetAccelerator("SaveModule", .AccelKey)
  9457.         .InsertItem("SaveModuleAs", "Save Module As...", -1)
  9458.         .InsertItem("UnloadModule", "&Unload Module", -1)
  9459.         .InsertSeparator(-1)
  9460.         .InsertItem("SaveAll", "Save &All", -1)
  9461.         .AccelKey = "Ctrl+A"
  9462.         .SetAccelerator("SaveAll", .AccelKey)
  9463.         .InsertSeparator(-1)
  9464.         .InsertItem("QuitApp", "E&xit", -1)
  9465.         .AccelKey = "Alt+End"
  9466.         .SetAccelerator("QuitApp", .AccelKey)
  9467.       End With  'EnvelopForm.EnvelopMenus.EnvelopFileMenu
  9468.       With .EnvelopObjectMenu
  9469.  
  9470.         .InsertItem("NewObject", "&New...", -1)
  9471.         .InsertItem("NewForm", "New &Form", -1)
  9472.         .InsertItem("CopyObject", "&Copy...", -1)
  9473.         .InsertItem("QuickCopy", "&Quick copy", -1)
  9474.         .AccelKey = "Ctrl+C"
  9475.         .SetAccelerator("QuickCopy", .AccelKey)
  9476.         .InsertItem("AbstractObject", "&Abstract...", -1)
  9477.         .InsertSeparator(-1)
  9478.         .InsertItem("RenameObject", "&Rename...", -1)
  9479.         .AccelKey = "Ctrl+R"
  9480.         .SetAccelerator("RenameObject", .AccelKey)
  9481.         .InsertItem("MoveObject", "Move to envelop.ebo", -1)
  9482.         .AccelKey = "Ctrl+M"
  9483.         .SetAccelerator("MoveObject", .AccelKey)
  9484.         .InsertSeparator(-1)
  9485.         .InsertItem("DeleteObject", "&Destroy Object", -1)
  9486.         .AccelKey = "Ctrl+D"
  9487.         .SetAccelerator("DeleteObject", .AccelKey)
  9488.         .InsertSeparator(-1)
  9489.         .InsertItem("WriteText", "&Save As Text...", -1)
  9490.         .AccelKey = "Ctrl+W"
  9491.         .SetAccelerator("WriteText", .AccelKey)
  9492.       End With  'EnvelopForm.EnvelopMenus.EnvelopObjectMenu
  9493.       With .EnvelopOptionsMenu
  9494.  
  9495.         .InsertItem("TrapInterp", "Trap Interpretive Exceptions", -1)
  9496.         .InsertItem("TrapSys", "Trap System Exceptions", -1)
  9497.         .InsertSeparator(-1)
  9498.         .InsertItem("ToggleEdit", "Enable Form Editor", -1)
  9499.         .AccelKey = "Ctrl+F"
  9500.         .SetAccelerator("ToggleEdit", .AccelKey)
  9501.         .InsertSeparator(-1)
  9502.         .InsertItem("ConfigureLayout", "Window Layouts...", -1)
  9503.         .InsertSeparator(-1)
  9504.         .InsertItem("StartupOptions", "Startup...", -1)
  9505.       End With  'EnvelopForm.EnvelopMenus.EnvelopOptionsMenu
  9506.       With .EnvelopHelpMenu
  9507.  
  9508.         .InsertItem("HelpTopics", "Envelop &Help Topics", -1)
  9509.         .InsertSeparator(-1)
  9510.         .InsertItem("HelpSamples", "&Samples", -1)
  9511.         .InsertSeparator(-1)
  9512.         .InsertItem("About", "About Envelop", -1)
  9513.       End With  'EnvelopForm.EnvelopMenus.EnvelopHelpMenu
  9514.       With .EnvelopToolsMenu
  9515.  
  9516.         .InsertItem("PropertyEditor", "&Property Editor", -1)
  9517.         .InsertItem("ObjectBrowser", "&Object Viewer", -1)
  9518.         .InsertItem("MethodBrowser", "&Method Editor", -1)
  9519.         .InsertItem("SourceBrowser", "&Source Searcher", -1)
  9520.         .InsertItem("MenuEditor", "Me&nu Editor", -1)
  9521.         .InsertItem("AppEditor", "&Application Editor", -1)
  9522.         .InsertItem("WorkSet", "&WorkSet", -1)
  9523.         .InsertItem("GroupEditor", "&Group Editor", -1)
  9524.         .InsertSeparator(-1)
  9525.         .InsertItem("ToolPalette", "&Tool Palette", -1)
  9526.         .InsertItem("ControlPalette", "&Controls Palette", -1)
  9527.         .InsertSeparator(-1)
  9528.         .InsertItem("DebugWindow", "&Debug Window", -1)
  9529.         .InsertSeparator(-1)
  9530.         .InsertItem("CloseAll", "Close All", -1)
  9531.       End With  'EnvelopForm.EnvelopMenus.EnvelopToolsMenu
  9532.     End With  'EnvelopForm.EnvelopMenus
  9533.     With .LblEditObj
  9534.       .Caption := "Selected:"
  9535.       .Font := EnvelopFont
  9536.       .ZOrder := 2
  9537.       .Move(10845, 60, 900, 255)
  9538.       .WordWrap := False
  9539.     End With  'EnvelopForm.LblEditObj
  9540.     With .toolbar
  9541.       .ZOrder := 3
  9542.       .Move(-30, -30, 15240, 405)
  9543.       .LayoutStyle := "ToolBar"
  9544.       .MarginLeft := 10
  9545.       .Visible := True
  9546.       With .NewProject
  9547.         .Separator := 3
  9548.         .Position := 1
  9549.         .HintText := "New project"
  9550.         With .bitmap
  9551.           .FileName := "envelop.ero"
  9552.           .ResId := 16852
  9553.         End With  'EnvelopForm.toolbar.NewProject.bitmap
  9554.       End With  'EnvelopForm.toolbar.NewProject
  9555.       With .OpenProject
  9556.         .Separator := 3
  9557.         .Position := 2
  9558.         .HintText := "Open project"
  9559.         With .bitmap
  9560.           .FileName := "envelop.ero"
  9561.           .ResId := 17096
  9562.         End With  'EnvelopForm.toolbar.OpenProject.bitmap
  9563.       End With  'EnvelopForm.toolbar.OpenProject
  9564.       With .SaveProject
  9565.         .Separator := 3
  9566.         .Position := 3
  9567.         .HintText := "Save project: Application1"
  9568.         With .bitmap
  9569.           .FileName := "envelop.ero"
  9570.           .ResId := 17340
  9571.         End With  'EnvelopForm.toolbar.SaveProject.bitmap
  9572.       End With  'EnvelopForm.toolbar.SaveProject
  9573.       With .CloseProject
  9574.         .Separator := 21
  9575.         .Position := 4
  9576.         .HintText := "Close project: Application1"
  9577.         With .bitmap
  9578.           .FileName := "envelop.ero"
  9579.           .ResId := 17584
  9580.         End With  'EnvelopForm.toolbar.CloseProject.bitmap
  9581.       End With  'EnvelopForm.toolbar.CloseProject
  9582.       With .WorksetLeft
  9583.         .Separator := 3
  9584.         .Position := 5
  9585.         .HintText := "Workset Previous"
  9586.         With .bitmap
  9587.           .FileName := "envelop.ero"
  9588.           .ResId := 17828
  9589.         End With  'EnvelopForm.toolbar.WorksetLeft.bitmap
  9590.       End With  'EnvelopForm.toolbar.WorksetLeft
  9591.       With .Finger
  9592.         .Separator := 3
  9593.         .Position := 6
  9594.         .HintText := "Find Object to Edit"
  9595.         .oldCaption := "Envelop"
  9596.         .fingerStarted := False
  9597.         .oldAutoBusy := True
  9598.         .fingerPointer := 2
  9599.         With .bitmap
  9600.           .FileName := "envelop.ero"
  9601.           .ResId := 18072
  9602.         End With  'EnvelopForm.toolbar.Finger.bitmap
  9603.       End With  'EnvelopForm.toolbar.Finger
  9604.       With .WorksetRight
  9605.         .Separator := 19
  9606.         .Position := 7
  9607.         .HintText := "Workset Next"
  9608.         With .bitmap
  9609.           .FileName := "envelop.ero"
  9610.           .ResId := 18316
  9611.         End With  'EnvelopForm.toolbar.WorksetRight.bitmap
  9612.       End With  'EnvelopForm.toolbar.WorksetRight
  9613.       With .NewForm
  9614.         .Separator := 3
  9615.         .Position := 8
  9616.         .HintText := "New Form"
  9617.         With .bitmap
  9618.           .FileName := "envelop.ero"
  9619.           .ResId := 18560
  9620.         End With  'EnvelopForm.toolbar.NewForm.bitmap
  9621.       End With  'EnvelopForm.toolbar.NewForm
  9622.       With .CopyObject
  9623.         .Separator := 3
  9624.         .Position := 10
  9625.         .HintText := "Copy Object"
  9626.         With .bitmap
  9627.           .FileName := "envelop.ero"
  9628.           .ResId := 18804
  9629.         End With  'EnvelopForm.toolbar.CopyObject.bitmap
  9630.       End With  'EnvelopForm.toolbar.CopyObject
  9631.       With .AbstractObject
  9632.         .Separator := 3
  9633.         .Position := 11
  9634.         .HintText := "Abstract Object"
  9635.         With .bitmap
  9636.           .FileName := "envelop.ero"
  9637.           .ResId := 19048
  9638.         End With  'EnvelopForm.toolbar.AbstractObject.bitmap
  9639.       End With  'EnvelopForm.toolbar.AbstractObject
  9640.       With .DeleteObject
  9641.         .Separator := 30
  9642.         .Position := 12
  9643.         .HintText := "Delete Object"
  9644.         With .bitmap
  9645.           .FileName := "envelop.ero"
  9646.           .ResId := 19292
  9647.         End With  'EnvelopForm.toolbar.DeleteObject.bitmap
  9648.       End With  'EnvelopForm.toolbar.DeleteObject
  9649.       With .ToggleEdit
  9650.         .Separator := 30
  9651.         .Position := 13
  9652.         .State := "Down"
  9653.         .ButtonType := "NonExclusive"
  9654.         With .bitmap
  9655.           .FileName := "envelop.ero"
  9656.           .ResId := 19536
  9657.         End With  'EnvelopForm.toolbar.ToggleEdit.bitmap
  9658.       End With  'EnvelopForm.toolbar.ToggleEdit
  9659.       With .RestoreLayout
  9660.         .Separator := 30
  9661.         .Position := 14
  9662.         .HintText := "Restore Default Layout"
  9663.         With .bitmap
  9664.           .FileName := "envelop.ero"
  9665.           .ResId := 19780
  9666.         End With  'EnvelopForm.toolbar.RestoreLayout.bitmap
  9667.       End With  'EnvelopForm.toolbar.RestoreLayout
  9668.       With .Help
  9669.         .Position := 15
  9670.         .HintText := "Help Contents"
  9671.         .oldAutoBusy := False
  9672.         .fingerPointer := 13
  9673.         With .bitmap
  9674.           .ResId := 20024
  9675.         End With  'EnvelopForm.toolbar.Help.bitmap
  9676.       End With  'EnvelopForm.toolbar.Help
  9677.       With .NewObject
  9678.         .Separator := 3
  9679.         .Position := 9
  9680.         .HintText := "New Object"
  9681.         With .bitmap
  9682.           .FileName := "envelop.ero"
  9683.           .ResId := 20268
  9684.         End With  'EnvelopForm.toolbar.NewObject.bitmap
  9685.       End With  'EnvelopForm.toolbar.NewObject
  9686.     End With  'EnvelopForm.toolbar
  9687.     With .CBSelectedObject
  9688.       .Font := EnvelopFont
  9689.       .ZOrder := 1
  9690.       .Move(11820, 15, 3315, 315)
  9691.     End With  'EnvelopForm.CBSelectedObject
  9692.   End With  'EnvelopForm
  9693. ' Reconstruction commands for object: ObjDebug
  9694. '
  9695.   With ObjDebug
  9696.     .Obj := Nothing
  9697.     .Descriptor := ""
  9698.   End With  'ObjDebug
  9699. ' Reconstruction commands for object: ProjectStartupDialog
  9700. '
  9701.   With ProjectStartupDialog
  9702.     .Caption := "ProjectStartupDialog"
  9703.     .ForeColor := 16711680
  9704.     .Font := ProjectStartupDialog.font1
  9705.     .Move(2868, 2112, 6540, 4992)
  9706.     .BevelInner := "Raised"
  9707.     .BevelOuter := "Raised"
  9708.     .BorderWidth := 2
  9709.     .CancelButton := ProjectStartupDialog.BTNNoProject
  9710.     .BorderStyle := "None"
  9711.     .MaxButton := False
  9712.     .MinButton := False
  9713.     With .BTNOpenProject
  9714.       .Caption := "&Open Project"
  9715.       .Font := ProjectStartupDialog.BTNNewProject.font1
  9716.       .ZOrder := 2
  9717.       .Move(216, 2076, 1872, 1284)
  9718.     End With  'ProjectStartupDialog.BTNOpenProject
  9719.     With .BTNNewProject
  9720.       .Caption := "&New Project"
  9721.       .ForeColor := 0
  9722.       .Font := ProjectStartupDialog.BTNNewProject.font1
  9723.       .ZOrder := 3
  9724.       .Move(216, 744, 1872, 1284)
  9725.       With .font1
  9726.         .FaceName := "MS Sans Serif"
  9727.         .Size := 12.000000
  9728.         .Bold := True
  9729.         .Italic := False
  9730.         .Strikethru := False
  9731.       End With  'ProjectStartupDialog.BTNNewProject.font1
  9732.     End With  'ProjectStartupDialog.BTNNewProject
  9733.     With .BTNNoProject
  9734.       .Caption := "No Project"
  9735.       .Font := ProjectStartupDialog.BTNNewProject.font1
  9736.       .ZOrder := 4
  9737.       .Move(216, 3432, 1872, 1284)
  9738.     End With  'ProjectStartupDialog.BTNNoProject
  9739.     With .LblNewProject
  9740.       .Caption := "Configure a new application or component library project."
  9741.       .ZOrder := 5
  9742.       .Move(2250, 1140, 4110, 465)
  9743.     End With  'ProjectStartupDialog.LblNewProject
  9744.     With .LblNoProject
  9745.       .Caption := "Start with no project opened."
  9746.       .ZOrder := 6
  9747.       .Move(2250, 3975, 4110, 225)
  9748.     End With  'ProjectStartupDialog.LblNoProject
  9749.     With .LblOpenProject
  9750.       .Caption := "Browse for an existing project file to open."
  9751.       .ZOrder := 7
  9752.       .Move(2250, 2475, 4110, 450)
  9753.     End With  'ProjectStartupDialog.LblOpenProject
  9754.     With .LblHeader
  9755.       .Caption := "Envelop Startup"
  9756.       .BackColor := 8421504
  9757.       .ForeColor := 0
  9758.       .Font := ProjectStartupDialog.LblHeader.font
  9759.       .ZOrder := 1
  9760.       .Move(120, 120, 6300, 444)
  9761.       .Alignment := "Center"
  9762.       With .font
  9763.         .FaceName := "MS Sans Serif"
  9764.         .Size := 18.000000
  9765.         .Bold := True
  9766.         .Italic := False
  9767.         .Strikethru := False
  9768.       End With  'ProjectStartupDialog.LblHeader.font
  9769.     End With  'ProjectStartupDialog.LblHeader
  9770.     With .font1
  9771.       .FaceName := "MS Sans Serif"
  9772.       .Size := 9.000000
  9773.       .Bold := True
  9774.       .Italic := False
  9775.       .Strikethru := False
  9776.     End With  'ProjectStartupDialog.font1
  9777.   End With  'ProjectStartupDialog
  9778. ' Reconstruction commands for object: AboutEnvelopForm
  9779. '
  9780.   With AboutEnvelopForm
  9781.     .Caption := "About Envelop"
  9782.     .Move(3144, 2808, 6000, 3600)
  9783.     .KeyPreview := True
  9784.     .BorderStyle := "None"
  9785.     With .bitmap
  9786.       .LoadType := "MemoryBased"
  9787.       .FileName := "envelop.ero"
  9788.       .ResId := 20512
  9789.     End With  'AboutEnvelopForm.bitmap
  9790.     With .imgAbout
  9791.       .ZOrder := 11
  9792.       .Move(0, 0, 6000, 3600)
  9793.       .BevelOuter := "None"
  9794.       .AutoInitCropRect := False
  9795.       .Picture := AboutEnvelopForm.bitmap
  9796.       .ResizeMode := "Clip"
  9797.       .ScrollBars := "Never"
  9798.       .ScaleX := 1
  9799.       .ScaleY := 1
  9800.     End With  'AboutEnvelopForm.imgAbout
  9801.     With .lstDLLs
  9802.       .Font := DefaultDialogFont
  9803.       .ZOrder := 1
  9804.       .Move(3984, 576, 1536, 1944)
  9805.       .Visible := False
  9806.       .Sorted := False
  9807.     End With  'AboutEnvelopForm.lstDLLs
  9808.     With .MLReadMe
  9809.       .Caption := "MLReadMe"
  9810.       .ZOrder := 2
  9811.       .Move(3984, 576, 1536, 192)
  9812.     End With  'AboutEnvelopForm.MLReadMe
  9813.     With .MLRelNotes
  9814.       .Caption := "MLRelNotes"
  9815.       .ZOrder := 3
  9816.       .Move(3984, 768, 1536, 192)
  9817.     End With  'AboutEnvelopForm.MLRelNotes
  9818.     With .MLTrouble
  9819.       .Caption := "MLTrouble"
  9820.       .ZOrder := 4
  9821.       .Move(3984, 960, 1536, 192)
  9822.     End With  'AboutEnvelopForm.MLTrouble
  9823.     With .MLLicense
  9824.       .Caption := "MLLicense"
  9825.       .ZOrder := 5
  9826.       .Move(3984, 1212, 1536, 192)
  9827.     End With  'AboutEnvelopForm.MLLicense
  9828.     With .MLRegister
  9829.       .Caption := "MLRegister"
  9830.       .ZOrder := 6
  9831.       .Move(3984, 1404, 1536, 192)
  9832.     End With  'AboutEnvelopForm.MLRegister
  9833.     With .MLStory
  9834.       .Caption := "MLStory"
  9835.       .ZOrder := 7
  9836.       .Move(3984, 1656, 1536, 192)
  9837.     End With  'AboutEnvelopForm.MLStory
  9838.     With .MLJoinUs
  9839.       .Caption := "MLJoinUs"
  9840.       .ZOrder := 8
  9841.       .Move(3984, 1848, 1536, 192)
  9842.     End With  'AboutEnvelopForm.MLJoinUs
  9843.     With .MLOK
  9844.       .Caption := "MLOK"
  9845.       .ZOrder := 9
  9846.       .Move(3984, 2100, 1536, 192)
  9847.     End With  'AboutEnvelopForm.MLOK
  9848.     With .MLVersion
  9849.       .ZOrder := 10
  9850.       .Move(3984, 2352, 1536, 192)
  9851.     End With  'AboutEnvelopForm.MLVersion
  9852.   End With  'AboutEnvelopForm
  9853. ' Reconstruction commands for object: WorkSet
  9854. '
  9855.   With WorkSet
  9856.     With .WorkSetForm
  9857.       .Caption := "WorkSet"
  9858.       .Move(6735, 2220, 3420, 2835)
  9859.       .AccelForm := EnvelopForm
  9860.       .ListMaxItems := 10
  9861.       .IgnoreClick := 0
  9862.       With .List
  9863.         .BackColor := 12632256
  9864.         .ZOrder := 1
  9865.         .Move(0, 0, 3300, 2430)
  9866.         .Sorted := False
  9867.       End With  'WorkSet.WorkSetForm.List
  9868.     End With  'WorkSet.WorkSetForm
  9869.   End With  'WorkSet
  9870. ' Reconstruction commands for object: ObjectBoxConfigWizard
  9871. '
  9872.   With ObjectBoxConfigWizard
  9873.     .title_ := "Configure ObjectBox"
  9874.     .Title := "Configure ObjectBox"
  9875.     .GraphicFileName := "envelop.ero"
  9876.     .FirstStep := ObjectBoxConfigWizard.ObjBoxMargin
  9877.     .LastStep := ObjectBoxConfigWizard.ObjBoxColumns
  9878.     With .ObjBoxMargin
  9879.       .Caption := "Configure ObjectBox"
  9880.       .Move(5850, 5595, 7155, 4815)
  9881.       .DefaultButton := ObjectBoxConfigWizard.ObjBoxMargin.BtnNext
  9882.       .CancelButton := Nothing
  9883.       .wizard := ObjectBoxConfigWizard
  9884.       .NextStep := ObjectBoxConfigWizard.ObjBoxLayout
  9885.       .initialized := -1
  9886.       With .TBTop
  9887.         .ZOrder := 8
  9888.         .Move(4200, 1500, 1200, 300)
  9889.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.TBTop
  9890.       With .TBLeft
  9891.         .ZOrder := 7
  9892.         .Move(3000, 2100, 1200, 300)
  9893.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.TBLeft
  9894.       With .TBRight
  9895.         .ZOrder := 5
  9896.         .Move(5400, 2100, 1200, 300)
  9897.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.TBRight
  9898.       With .TBBottom
  9899.         .ZOrder := 6
  9900.         .Move(4200, 2775, 1200, 300)
  9901.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.TBBottom
  9902.       With .LBLTop
  9903.         .Caption := "Top"
  9904.         .ZOrder := 4
  9905.         .Move(4200, 1200, 1200, 225)
  9906.         .Alignment := "Center"
  9907.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.LBLTop
  9908.       With .LBLLeft
  9909.         .Caption := "Left"
  9910.         .ZOrder := 3
  9911.         .Move(3000, 1800, 1200, 225)
  9912.         .Alignment := "Center"
  9913.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.LBLLeft
  9914.       With .LBLRight
  9915.         .Caption := "Right"
  9916.         .ZOrder := 1
  9917.         .Move(5400, 1800, 1200, 225)
  9918.         .Alignment := "Center"
  9919.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.LBLRight
  9920.       With .LBLBottom
  9921.         .Caption := "Bottom"
  9922.         .ZOrder := 2
  9923.         .Move(4200, 2475, 1200, 225)
  9924.         .Alignment := "Center"
  9925.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.LBLBottom
  9926.       With .BtnFinish
  9927.         .ZOrder := 12
  9928.         .Move(6225, 4050, 825, 300)
  9929.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.BtnFinish
  9930.       With .BtnNext
  9931.         .ZOrder := 11
  9932.         .Move(5325, 4050, 825, 300)
  9933.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.BtnNext
  9934.       With .BtnBack
  9935.         .Enabled := False
  9936.         .ZOrder := 10
  9937.         .Move(4500, 4050, 825, 300)
  9938.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.BtnBack
  9939.       With .BtnCancel
  9940.         .ZOrder := 9
  9941.         .Move(3600, 4050, 825, 300)
  9942.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.BtnCancel
  9943.       With .ImgGraphic
  9944.         .ZOrder := 15
  9945.         .Move(225, 225, 2475, 3150)
  9946.         .Picture := ObjectBoxConfigWizard.Bitmap
  9947.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.ImgGraphic
  9948.       With .LblInstruction
  9949.         .Caption := "Set the Top, Bottom, Left and Right Margins for the ObjectBox"
  9950.         .ZOrder := 14
  9951.         .Move(2850, 300, 4125, 450)
  9952.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.LblInstruction
  9953.       With .Frame1
  9954.         .ZOrder := 13
  9955.         .Move(75, 3825, 6975, 75)
  9956.       End With  'ObjectBoxConfigWizard.ObjBoxMargin.Frame1
  9957.     End With  'ObjectBoxConfigWizard.ObjBoxMargin
  9958.     With .ObjBoxLayout
  9959.       .Caption := "Configure ObjectBox"
  9960.       .Move(5850, 5595, 7155, 4815)
  9961.       .DefaultButton := ObjectBoxConfigWizard.ObjBoxLayout.BtnBack
  9962.       .CancelButton := Nothing
  9963.       .wizard := ObjectBoxConfigWizard
  9964.       .NextStep := ObjectBoxConfigWizard.ObjBoxColumns
  9965.       .BackStep := ObjectBoxConfigWizard.ObjBoxMargin
  9966.       With .OBToolBar
  9967.         .Caption := "ToolBar"
  9968.         .ZOrder := 2
  9969.         .Move(3000, 975, 3675, 300)
  9970.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.OBToolBar
  9971.       With .OBToolBox
  9972.         .Caption := "ToolBox"
  9973.         .ZOrder := 1
  9974.         .Move(3000, 1350, 3675, 300)
  9975.         .TabStop := True
  9976.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.OBToolBox
  9977.       With .BtnFinish
  9978.         .ZOrder := 6
  9979.         .Move(6225, 4050, 825, 300)
  9980.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.BtnFinish
  9981.       With .BtnNext
  9982.         .ZOrder := 5
  9983.         .Move(5325, 4050, 825, 300)
  9984.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.BtnNext
  9985.       With .BtnBack
  9986.         .ZOrder := 4
  9987.         .Move(4500, 4050, 825, 300)
  9988.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.BtnBack
  9989.       With .BtnCancel
  9990.         .ZOrder := 3
  9991.         .Move(3600, 4050, 825, 300)
  9992.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.BtnCancel
  9993.       With .ImgGraphic
  9994.         .ZOrder := 9
  9995.         .Move(225, 225, 2475, 3150)
  9996.         .Picture := ObjectBoxConfigWizard.Bitmap
  9997.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.ImgGraphic
  9998.       With .LblInstruction
  9999.         .Caption := "Select the LayoutStyle for the ObjectBox"
  10000.         .ZOrder := 8
  10001.         .Move(2850, 300, 4125, 225)
  10002.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.LblInstruction
  10003.       With .Frame1
  10004.         .ZOrder := 7
  10005.         .Move(75, 3825, 6975, 75)
  10006.       End With  'ObjectBoxConfigWizard.ObjBoxLayout.Frame1
  10007.     End With  'ObjectBoxConfigWizard.ObjBoxLayout
  10008.     With .ObjBoxTileDir
  10009.       .Caption := "Configure ObjectBox"
  10010.       .Move(5850, 5595, 7155, 4815)
  10011.       .DefaultButton := ObjectBoxConfigWizard.ObjBoxTileDir.BtnFinish
  10012.       .CancelButton := Nothing
  10013.       .wizard := ObjectBoxConfigWizard
  10014.       .BackStep := ObjectBoxConfigWizard.ObjBoxLayout
  10015.       With .OBHoriz
  10016.         .Caption := "Horizontal tiling"
  10017.         .ZOrder := 2
  10018.         .Move(3300, 1050, 3300, 375)
  10019.         .TabStop := True
  10020.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.OBHoriz
  10021.       With .OBVertical
  10022.         .Caption := "Vertical tiling"
  10023.         .ZOrder := 1
  10024.         .Move(3300, 1500, 3300, 375)
  10025.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.OBVertical
  10026.       With .BtnFinish
  10027.         .ZOrder := 6
  10028.         .Move(6225, 4050, 825, 300)
  10029.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.BtnFinish
  10030.       With .BtnNext
  10031.         .Enabled := False
  10032.         .ZOrder := 5
  10033.         .Move(5325, 4050, 825, 300)
  10034.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.BtnNext
  10035.       With .BtnBack
  10036.         .ZOrder := 4
  10037.         .Move(4500, 4050, 825, 300)
  10038.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.BtnBack
  10039.       With .BtnCancel
  10040.         .ZOrder := 3
  10041.         .Move(3600, 4050, 825, 300)
  10042.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.BtnCancel
  10043.       With .ImgGraphic
  10044.         .ZOrder := 9
  10045.         .Move(225, 225, 2475, 3150)
  10046.         .Picture := ObjectBoxConfigWizard.Bitmap
  10047.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.ImgGraphic
  10048.       With .LblInstruction
  10049.         .Caption := "Select Horizontal or Vertical tiling for your ToolBar."
  10050.         .ZOrder := 8
  10051.         .Move(2850, 300, 4125, 450)
  10052.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.LblInstruction
  10053.       With .Frame1
  10054.         .ZOrder := 7
  10055.         .Move(75, 3825, 6975, 75)
  10056.       End With  'ObjectBoxConfigWizard.ObjBoxTileDir.Frame1
  10057.     End With  'ObjectBoxConfigWizard.ObjBoxTileDir
  10058.     With .ObjBoxColumns
  10059.       .Caption := "Configure ObjectBox"
  10060.       .Move(5850, 5595, 7155, 4815)
  10061.       .DefaultButton := ObjectBoxConfigWizard.ObjBoxColumns.BtnFinish
  10062.       .CancelButton := Nothing
  10063.       .wizard := ObjectBoxConfigWizard
  10064.       .BackStep := ObjectBoxConfigWizard.ObjBoxLayout
  10065.       With .SBColumns
  10066.         .Caption := "SBColumns"
  10067.         .ZOrder := 2
  10068.         .Move(3000, 1800, 3675, 300)
  10069.         .SmallChange := 1
  10070.         .LargeChange := 5
  10071.         .Max := 20
  10072.         .Orientation := "Horizontal"
  10073.         .Move(3000, 1800, 3675, 300)
  10074.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.SBColumns
  10075.       With .LblColumns
  10076.         .Caption := "Columns: 2"
  10077.         .ZOrder := 1
  10078.         .Move(4200, 1500, 1350, 225)
  10079.         .Alignment := "Center"
  10080.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.LblColumns
  10081.       With .BtnFinish
  10082.         .ZOrder := 6
  10083.         .Move(6225, 4050, 825, 300)
  10084.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.BtnFinish
  10085.       With .BtnNext
  10086.         .Enabled := False
  10087.         .ZOrder := 5
  10088.         .Move(5325, 4050, 825, 300)
  10089.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.BtnNext
  10090.       With .BtnBack
  10091.         .ZOrder := 4
  10092.         .Move(4500, 4050, 825, 300)
  10093.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.BtnBack
  10094.       With .BtnCancel
  10095.         .ZOrder := 3
  10096.         .Move(3600, 4050, 825, 300)
  10097.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.BtnCancel
  10098.       With .ImgGraphic
  10099.         .ZOrder := 9
  10100.         .Move(225, 225, 2475, 3150)
  10101.         .Picture := ObjectBoxConfigWizard.Bitmap
  10102.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.ImgGraphic
  10103.       With .LblInstruction
  10104.         .Caption := "How many columns should there be in the ObjectBox."
  10105.         .ZOrder := 8
  10106.         .Move(2850, 300, 4125, 450)
  10107.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.LblInstruction
  10108.       With .Frame1
  10109.         .ZOrder := 7
  10110.         .Move(75, 3825, 6975, 75)
  10111.       End With  'ObjectBoxConfigWizard.ObjBoxColumns.Frame1
  10112.     End With  'ObjectBoxConfigWizard.ObjBoxColumns
  10113.     With .TempBox
  10114.       .Move(0, 0, 0, 0)
  10115.     End With  'ObjectBoxConfigWizard.TempBox
  10116.     With .Bitmap
  10117.       .LoadType := "MemoryBased"
  10118.       .FileName := "envelop.ero"
  10119.       .ResId := 171588
  10120.     End With  'ObjectBoxConfigWizard.Bitmap
  10121.   End With  'ObjectBoxConfigWizard
  10122. ' Reconstruction commands for object: SampleMasterFormMenuBar
  10123. '
  10124.   With SampleMasterFormMenuBar
  10125.  
  10126.     .InsertPopup(SampleMasterFormFileMenu, "&File", -1)
  10127.     .InsertPopup(SampleMasterFormHelpMenu, "&Help", -1)
  10128.   End With  'SampleMasterFormMenuBar
  10129. ' Reconstruction commands for object: SampleMasterForm
  10130. '
  10131.   With SampleMasterForm
  10132.     .TextPreLoad()
  10133.     .Caption := "BOOT CAMP Sample"
  10134.     .Move(3840, 1170, 8370, 6060)
  10135.     .Outlined := True
  10136.     .MenuBar := SampleMasterFormMenuBar
  10137.     .SampleDir := "D:\ENVELOP\PROGRAM\"
  10138.     .SampleName := "envelop"
  10139.     With .helpfile
  10140.       .FileName := "D:\ENVELOP\PROGRAM\envelop.hlp"
  10141.     End With  'SampleMasterForm.helpfile
  10142.   End With  'SampleMasterForm
  10143. ' Reconstruction commands for object: FormEditor
  10144. '
  10145.   With FormEditor
  10146.     .ShowOrder := False
  10147.     .GridOn := True
  10148.     .GridX := 10
  10149.     .GridY := 10
  10150.     .HitMode := "RgnTouches"
  10151.     .Editing := True
  10152.   End With  'FormEditor
  10153. ' Reconstruction commands for object: SampleMasterFormFileMenu
  10154. '
  10155.   With SampleMasterFormFileMenu
  10156.  
  10157.     .InsertItem("ResetApplication", "&Reset", -1)
  10158.     .InsertSeparator(-1)
  10159.     .InsertItem("ExitApplication", "E&xit", -1)
  10160.   End With  'SampleMasterFormFileMenu
  10161. ' Reconstruction commands for object: Debugger
  10162. '
  10163.   With Debugger
  10164.     .TrapSystemExceptions := True
  10165.     .TrapInterpretiveExceptions := False
  10166.     .IgnoreExceptionsModule := 7
  10167.   End With  'Debugger
  10168. ' Reconstruction commands for object: MenuEdit
  10169. '
  10170.   With MenuEdit
  10171.     .Caption := "MenuEdit"
  10172.     .Font := DefaultDialogFont
  10173.     .Move(1185, 1815, 6540, 8655)
  10174.     .ICN_CLOSEDFOLDER := 0
  10175.     .ICN_OPENFOLDER := 1
  10176.     .ICN_MENUITEM := 2
  10177.     .ICN_SEPARATOR := 3
  10178.     .DraggingIndex := 1
  10179.     .InputMenu := Nothing
  10180.     .WorkingMenu := Nothing
  10181.     .UpdatingProperties := 0
  10182.     .SuppressUpdatingProperties := 0
  10183.     With .menuList
  10184.       .Caption := "menuList"
  10185.       .BackColor := 12632256
  10186.       .DragMode := "LeftMouse"
  10187.       .ZOrder := 9
  10188.       .Move(0, 1275, 6420, 6975)
  10189.       .ExpandOnDblClick := True
  10190.       .IconBitmap := MenuEdit.menuList.bitmaps
  10191.       .IconHeight := 16
  10192.       .IconWidth := 20
  10193.       .IndentWidth := 20
  10194.       With .bitmaps
  10195.         .LoadType := "MemoryBased"
  10196.         .FileName := "envelop.ero"
  10197.         .ResId := 173296
  10198.       End With  'MenuEdit.menuList.bitmaps
  10199.     End With  'MenuEdit.menuList
  10200.     With .menutools
  10201.       .Caption := "ObjectBox1"
  10202.       .ZOrder := 8
  10203.       .Move(0, 0, 6420, 405)
  10204.       .LayoutStyle := "ToolBar"
  10205.       .Visible := True
  10206.       With .openmenu
  10207.         .Position := 1
  10208.         .HintText := "Open  new menu to edit"
  10209.         With .bitmap
  10210.           .FileName := "envelop.ero"
  10211.           .ResId := 174372
  10212.         End With  'MenuEdit.menutools.openmenu.bitmap
  10213.       End With  'MenuEdit.menutools.openmenu
  10214.       With .testdrive
  10215.         .Enabled := False
  10216.         .Position := 2
  10217.         .HintText := "Test drive your menus"
  10218.         With .bitmap
  10219.           .FileName := "envelop.ero"
  10220.           .ResId := 175704
  10221.         End With  'MenuEdit.menutools.testdrive.bitmap
  10222.       End With  'MenuEdit.menutools.testdrive
  10223.       With .apply
  10224.         .Enabled := False
  10225.         .Separator := 13
  10226.         .Position := 3
  10227.         .HintText := "Apply your changes to the orginal menu"
  10228.         With .bitmap
  10229.           .FileName := "envelop.ero"
  10230.           .ResId := 177036
  10231.         End With  'MenuEdit.menutools.apply.bitmap
  10232.       End With  'MenuEdit.menutools.apply
  10233.       With .insertitem
  10234.         .Enabled := False
  10235.         .Position := 4
  10236.         .HintText := "Insert a new command item"
  10237.         With .bitmap
  10238.           .FileName := "envelop.ero"
  10239.           .ResId := 178368
  10240.         End With  'MenuEdit.menutools.insertitem.bitmap
  10241.       End With  'MenuEdit.menutools.insertitem
  10242.       With .insertsubmenu
  10243.         .Enabled := False
  10244.         .Position := 5
  10245.         .HintText := "Insert a new sub-menu"
  10246.         With .bitmap
  10247.           .FileName := "envelop.ero"
  10248.           .ResId := 179700
  10249.         End With  'MenuEdit.menutools.insertsubmenu.bitmap
  10250.       End With  'MenuEdit.menutools.insertsubmenu
  10251.       With .insertsep
  10252.         .Enabled := False
  10253.         .Separator := 12
  10254.         .Position := 6
  10255.         .HintText := "Insert a new separator"
  10256.         With .bitmap
  10257.           .FileName := "envelop.ero"
  10258.           .ResId := 181032
  10259.         End With  'MenuEdit.menutools.insertsep.bitmap
  10260.       End With  'MenuEdit.menutools.insertsep
  10261.       With .delitem
  10262.         .Enabled := False
  10263.         .Position := 8
  10264.         .HintText := "Delete the current item"
  10265.         With .bitmap
  10266.           .FileName := "envelop.ero"
  10267.           .ResId := 182364
  10268.         End With  'MenuEdit.menutools.delitem.bitmap
  10269.       End With  'MenuEdit.menutools.delitem
  10270.       With .moveup
  10271.         .Enabled := False
  10272.         .Position := 9
  10273.         .HintText := "Move the current item up"
  10274.         With .bitmap
  10275.           .FileName := "envelop.ero"
  10276.           .ResId := 183696
  10277.         End With  'MenuEdit.menutools.moveup.bitmap
  10278.       End With  'MenuEdit.menutools.moveup
  10279.       With .movedown
  10280.         .Enabled := False
  10281.         .Position := 10
  10282.         .HintText := "Move the current item down"
  10283.         With .bitmap
  10284.           .FileName := "envelop.ero"
  10285.           .ResId := 185028
  10286.         End With  'MenuEdit.menutools.movedown.bitmap
  10287.       End With  'MenuEdit.menutools.movedown
  10288.       With .properties
  10289.         .Position := 7
  10290.         .State := "Down"
  10291.         .HintText := "Modify item properties"
  10292.         With .bitmap
  10293.           .FileName := "envelop.ero"
  10294.           .ResId := 186360
  10295.         End With  'MenuEdit.menutools.properties.bitmap
  10296.       End With  'MenuEdit.menutools.properties
  10297.     End With  'MenuEdit.menutools
  10298.     With .Label1
  10299.       .Caption := "Caption:"
  10300.       .ZOrder := 7
  10301.       .Move(0, 525, 900, 300)
  10302.       .Alignment := "Right"
  10303.     End With  'MenuEdit.Label1
  10304.     With .Label2
  10305.       .Caption := "Name:"
  10306.       .ZOrder := 6
  10307.       .Move(0, 975, 900, 300)
  10308.       .Alignment := "Right"
  10309.     End With  'MenuEdit.Label2
  10310.     With .txtCaption
  10311.       .Enabled := False
  10312.       .ZOrder := 5
  10313.       .Move(900, 450, 2400, 300)
  10314.     End With  'MenuEdit.txtCaption
  10315.     With .txtName
  10316.       .Enabled := False
  10317.       .ZOrder := 4
  10318.       .Move(900, 900, 2400, 300)
  10319.     End With  'MenuEdit.txtName
  10320.     With .Label3
  10321.       .Caption := "Shortcut:"
  10322.       .ZOrder := 3
  10323.       .Move(3600, 525, 900, 300)
  10324.       .Alignment := "Right"
  10325.     End With  'MenuEdit.Label3
  10326.     With .chkChecked
  10327.       .Caption := "Checked"
  10328.       .Enabled := False
  10329.       .ZOrder := 2
  10330.       .Move(3750, 900, 1500, 300)
  10331.     End With  'MenuEdit.chkChecked
  10332.     With .cbAccel
  10333.       .Enabled := False
  10334.       .ZOrder := 1
  10335.       .Move(4500, 450, 1800, 315)
  10336.       .Sorted := False
  10337.       .Style := "DropdownList"
  10338.     End With  'MenuEdit.cbAccel
  10339.   End With  'MenuEdit
  10340. ' Reconstruction commands for object: PropertyEditor
  10341. '
  10342.   With PropertyEditor
  10343.     .SimplePropTextStyle := "Normal"
  10344.     .SimplePropTextColor := -1
  10345.     .EmbedPropTextStyle := "Normal"
  10346.     .EmbedPropTextColor := 8388608
  10347.     .ReferencePropTextStyle := "Italic"
  10348.     .ReferencePropTextColor := 128
  10349.     .InheritedPropTextStyle := "Normal"
  10350.     .InheritedPropTextColor := -1
  10351.     .NonInheritedPropTextStyle := "Bold"
  10352.     .NonInheritedPropTextColor := -1
  10353.     With .DimensionArrayForm
  10354.       .Caption := "Dimension Array"
  10355.       .Font := EnvelopFont
  10356.       .Move(4560, 3570, 4635, 1935)
  10357.       .DefaultButton := PropertyEditor.DimensionArrayForm.BtnOK
  10358.       .CancelButton := PropertyEditor.DimensionArrayForm.BtnCancel
  10359.       .posDim := 1
  10360.       .posOpen := 7
  10361.       .posName := 4
  10362.       .posClose := 10
  10363.       .posDims := 8
  10364.       .posAs := 12
  10365.       .posType := 14
  10366.       .ignoreChange := False
  10367.       With .TBStmt
  10368.         .ZOrder := 1
  10369.         .Move(1155, 90, 2280, 285)
  10370.       End With  'PropertyEditor.DimensionArrayForm.TBStmt
  10371.       With .LblName
  10372.         .Caption := "Name:"
  10373.         .ZOrder := 10
  10374.         .Move(75, 540, 1035, 240)
  10375.         .Alignment := "Right"
  10376.       End With  'PropertyEditor.DimensionArrayForm.LblName
  10377.       With .LblDims
  10378.         .Caption := "Dimensions:"
  10379.         .ZOrder := 9
  10380.         .Move(75, 855, 1035, 240)
  10381.         .Alignment := "Right"
  10382.       End With  'PropertyEditor.DimensionArrayForm.LblDims
  10383.       With .CBType
  10384.         .ZOrder := 4
  10385.         .Move(1155, 1140, 1140, 300)
  10386.         .Sorted := False
  10387.         .Style := "DropdownList"
  10388.       End With  'PropertyEditor.DimensionArrayForm.CBType
  10389.       With .LblType
  10390.         .Caption := "Type:"
  10391.         .ZOrder := 8
  10392.         .Move(75, 1170, 1035, 240)
  10393.         .Alignment := "Right"
  10394.       End With  'PropertyEditor.DimensionArrayForm.LblType
  10395.       With .LblStmt
  10396.         .Caption := "Statement:"
  10397.         .ZOrder := 7
  10398.         .Move(75, 135, 1035, 240)
  10399.         .Alignment := "Right"
  10400.       End With  'PropertyEditor.DimensionArrayForm.LblStmt
  10401.       With .TBName
  10402.         .ZOrder := 2
  10403.         .Move(1155, 495, 2280, 285)
  10404.       End With  'PropertyEditor.DimensionArrayForm.TBName
  10405.       With .TBDims
  10406.         .ZOrder := 3
  10407.         .Move(1155, 825, 2280, 270)
  10408.       End With  'PropertyEditor.DimensionArrayForm.TBDims
  10409.       With .BtnOK
  10410.         .Caption := "OK"
  10411.         .ZOrder := 5
  10412.         .Move(3525, 90, 900, 300)
  10413.       End With  'PropertyEditor.DimensionArrayForm.BtnOK
  10414.       With .BtnCancel
  10415.         .Caption := "Cancel"
  10416.         .ZOrder := 6
  10417.         .Move(3525, 480, 900, 300)
  10418.       End With  'PropertyEditor.DimensionArrayForm.BtnCancel
  10419.     End With  'PropertyEditor.DimensionArrayForm
  10420.     With .EnumPicker
  10421.       .Caption := "Select an Enumeration type"
  10422.       .Font := EnvelopFont
  10423.       .Move(4695, 3480, 4650, 2955)
  10424.       .DefaultButton := PropertyEditor.EnumPicker.BtnOk
  10425.       .CancelButton := PropertyEditor.EnumPicker.BtnCancel
  10426.       With .EnumList
  10427.         .Caption := "EnumList"
  10428.         .BackColor := 16777215
  10429.         .ZOrder := 3
  10430.         .Move(150, 150, 2700, 2175)
  10431.       End With  'PropertyEditor.EnumPicker.EnumList
  10432.       With .BtnOk
  10433.         .Caption := "OK"
  10434.         .ZOrder := 2
  10435.         .Move(3150, 150, 1200, 375)
  10436.       End With  'PropertyEditor.EnumPicker.BtnOk
  10437.       With .BtnCancel
  10438.         .Caption := "Cancel"
  10439.         .ZOrder := 1
  10440.         .Move(3150, 675, 1200, 375)
  10441.       End With  'PropertyEditor.EnumPicker.BtnCancel
  10442.     End With  'PropertyEditor.EnumPicker
  10443.     With .ObjPicker
  10444.       .Caption := "Select Object"
  10445.       .Font := EnvelopFont
  10446.       .Move(4875, 3750, 4470, 2985)
  10447.       .BevelOuter := "Raised"
  10448.       .DefaultButton := PropertyEditor.ObjPicker.BtnOk
  10449.       .CancelButton := PropertyEditor.ObjPicker.BtnCancel
  10450.       With .BtnOk
  10451.         .Caption := "OK"
  10452.         .ZOrder := 2
  10453.         .Move(3230, 90, 1050, 300)
  10454.       End With  'PropertyEditor.ObjPicker.BtnOk
  10455.       With .BtnCancel
  10456.         .Caption := "Cancel"
  10457.         .ZOrder := 3
  10458.         .Move(3230, 480, 1050, 300)
  10459.       End With  'PropertyEditor.ObjPicker.BtnCancel
  10460.       With .ObjList
  10461.         .Caption := "ObjList"
  10462.         .ZOrder := 1
  10463.         .Move(150, 375, 2850, 1800)
  10464.       End With  'PropertyEditor.ObjPicker.ObjList
  10465.       With .Label1
  10466.         .ZOrder := 7
  10467.         .Move(150, 75, 2855, 300)
  10468.       End With  'PropertyEditor.ObjPicker.Label1
  10469.       With .CBReference
  10470.         .Caption := "&Reference"
  10471.         .ZOrder := 4
  10472.         .Move(3095, 1155, 1185, 225)
  10473.       End With  'PropertyEditor.ObjPicker.CBReference
  10474.       With .CBUntyped
  10475.         .Caption := "&Untyped"
  10476.         .ZOrder := 5
  10477.         .Move(3095, 1470, 1185, 225)
  10478.       End With  'PropertyEditor.ObjPicker.CBUntyped
  10479.       With .CBShowEmbeds
  10480.         .Caption := "Show &embedded objects"
  10481.         .ZOrder := 6
  10482.         .Move(135, 2265, 2775, 225)
  10483.       End With  'PropertyEditor.ObjPicker.CBShowEmbeds
  10484.     End With  'PropertyEditor.ObjPicker
  10485.   End With  'PropertyEditor
  10486. ' Reconstruction commands for object: MenuTester
  10487. '
  10488.   With MenuTester
  10489.     .Caption := "MenuTester"
  10490.     .ForeColor := 0
  10491.     .Font := MenuTester.font1
  10492.     .Move(7770, 1815, 6330, 1680)
  10493.     With .Label1
  10494.       .Caption := "Test Drive Your Menu"
  10495.       .ZOrder := 1
  10496.       .Move(150, 450, 6000, 600)
  10497.       .Alignment := "Center"
  10498.     End With  'MenuTester.Label1
  10499.     With .font1
  10500.       .FaceName := "Times New Roman"
  10501.       .Size := 18.000000
  10502.       .Bold := True
  10503.       .Italic := False
  10504.       .Strikethru := False
  10505.     End With  'MenuTester.font1
  10506.   End With  'MenuTester
  10507. ' Reconstruction commands for object: MenuEditor
  10508. '
  10509.   With MenuEditor
  10510.     .Enabled := False
  10511.     With .SelectPopupForm
  10512.       .Caption := "Select PopupMenu"
  10513.       .Font := DefaultDialogFont
  10514.       .Move(4395, 4260, 5415, 1905)
  10515.       .DefaultButton := MenuEditor.SelectPopupForm.BtnOK
  10516.       .CancelButton := MenuEditor.SelectPopupForm.BtnCancel
  10517.       .MaxButton := False
  10518.       .HostMenu := Nothing
  10519.       With .CBPopups
  10520.         .ZOrder := 4
  10521.         .Move(915, 570, 3225, 300)
  10522.         .Visible := False
  10523.         .ShowDynamics := True
  10524.         .ShowEmbeds := True
  10525.         .RootObject := PopupMenu
  10526.         .Style := "Tree"
  10527.       End With  'MenuEditor.SelectPopupForm.CBPopups
  10528.       With .OptExisting
  10529.         .Caption := "&Existing:"
  10530.         .ZOrder := 2
  10531.         .Move(1950, 150, 1050, 285)
  10532.         .TabStop := True
  10533.       End With  'MenuEditor.SelectPopupForm.OptExisting
  10534.       With .OptNew
  10535.         .Caption := "&New:"
  10536.         .ZOrder := 1
  10537.         .Move(900, 150, 1050, 285)
  10538.         .TabGroup := True
  10539.       End With  'MenuEditor.SelectPopupForm.OptNew
  10540.       With .LblCaption
  10541.         .Caption := "Caption:"
  10542.         .ZOrder := 9
  10543.         .Move(150, 1080, 720, 240)
  10544.         .Alignment := "Right"
  10545.       End With  'MenuEditor.SelectPopupForm.LblCaption
  10546.       With .TECaption
  10547.         .ZOrder := 5
  10548.         .Move(915, 1050, 3225, 300)
  10549.       End With  'MenuEditor.SelectPopupForm.TECaption
  10550.       With .TEName
  10551.         .ZOrder := 3
  10552.         .Move(915, 570, 3225, 300)
  10553.       End With  'MenuEditor.SelectPopupForm.TEName
  10554.       With .BtnOK
  10555.         .Caption := "OK"
  10556.         .ZOrder := 6
  10557.         .Move(4320, 90, 885, 300)
  10558.       End With  'MenuEditor.SelectPopupForm.BtnOK
  10559.       With .BtnCancel
  10560.         .Caption := "Cancel"
  10561.         .ZOrder := 7
  10562.         .Move(4320, 480, 885, 300)
  10563.       End With  'MenuEditor.SelectPopupForm.BtnCancel
  10564.       With .LblName
  10565.         .Caption := "Name:"
  10566.         .ZOrder := 8
  10567.         .Move(150, 600, 735, 300)
  10568.         .Alignment := "Right"
  10569.       End With  'MenuEditor.SelectPopupForm.LblName
  10570.     End With  'MenuEditor.SelectPopupForm
  10571.   End With  'MenuEditor
  10572. ' Reconstruction commands for object: CtrlToolGadgetWizard
  10573. '
  10574.   With CtrlToolGadgetWizard
  10575.     .title_ := "Configure ControlTools.Gadget"
  10576.     .Title := "Configure ControlTools.Gadget"
  10577.     .GraphicFileName := "envelop.ero"
  10578.     .FirstStep := CtrlToolGadgetWizard.SelectObject
  10579.     .LastStep := CtrlToolGadgetWizard.SelectBitmap
  10580.     .ng := Nothing
  10581.     With .SelectObject
  10582.       .Caption := "Configure ControlTools.Gadget"
  10583.       .Move(3585, 6150, 7155, 4815)
  10584.       .DefaultButton := CtrlToolGadgetWizard.SelectObject.BtnNext
  10585.       .CancelButton := Nothing
  10586.       .wizard := CtrlToolGadgetWizard
  10587.       .NextStep := CtrlToolGadgetWizard.SelectBitmap
  10588.       With .TextBox1
  10589.         .ZOrder := 1
  10590.         .Move(2850, 1050, 4050, 525)
  10591.       End With  'CtrlToolGadgetWizard.SelectObject.TextBox1
  10592.       With .BtnFinish
  10593.         .ZOrder := 5
  10594.         .Move(6225, 4050, 825, 300)
  10595.       End With  'CtrlToolGadgetWizard.SelectObject.BtnFinish
  10596.       With .BtnNext
  10597.         .ZOrder := 4
  10598.         .Move(5325, 4050, 825, 300)
  10599.       End With  'CtrlToolGadgetWizard.SelectObject.BtnNext
  10600.       With .BtnBack
  10601.         .Enabled := False
  10602.         .ZOrder := 3
  10603.         .Move(4500, 4050, 825, 300)
  10604.       End With  'CtrlToolGadgetWizard.SelectObject.BtnBack
  10605.       With .BtnCancel
  10606.         .ZOrder := 2
  10607.         .Move(3600, 4050, 825, 300)
  10608.       End With  'CtrlToolGadgetWizard.SelectObject.BtnCancel
  10609.       With .ImgGraphic
  10610.         .ZOrder := 8
  10611.         .Move(225, 225, 2475, 3150)
  10612.         .Picture := CtrlToolGadgetWizard.Bitmap
  10613.       End With  'CtrlToolGadgetWizard.SelectObject.ImgGraphic
  10614.       With .LblInstruction
  10615.         .Caption := "What Object should we install?"
  10616.         .ZOrder := 7
  10617.         .Move(2850, 225, 4125, 300)
  10618.       End With  'CtrlToolGadgetWizard.SelectObject.LblInstruction
  10619.       With .Frame1
  10620.         .ZOrder := 6
  10621.         .Move(75, 3825, 6975, 75)
  10622.       End With  'CtrlToolGadgetWizard.SelectObject.Frame1
  10623.     End With  'CtrlToolGadgetWizard.SelectObject
  10624.     With .SelectBitmap
  10625.       .Caption := "Configure ControlTools.Gadget"
  10626.       .Move(3585, 6150, 7155, 4815)
  10627.       .DefaultButton := CtrlToolGadgetWizard.SelectBitmap.BtnFinish
  10628.       .CancelButton := Nothing
  10629.       .wizard := CtrlToolGadgetWizard
  10630.       .BackStep := CtrlToolGadgetWizard.SelectObject
  10631.       With .TextBox1
  10632.         .Caption := "TextBox1"
  10633.         .ZOrder := 3
  10634.         .Move(2850, 1050, 4050, 525)
  10635.       End With  'CtrlToolGadgetWizard.SelectBitmap.TextBox1
  10636.       With .BTNBrowse
  10637.         .Caption := "Browse..."
  10638.         .ZOrder := 2
  10639.         .Move(2850, 1725, 900, 375)
  10640.       End With  'CtrlToolGadgetWizard.SelectBitmap.BTNBrowse
  10641.       With .BTNPreview
  10642.         .Caption := "Preview"
  10643.         .ZOrder := 1
  10644.         .Move(6000, 1725, 900, 375)
  10645.       End With  'CtrlToolGadgetWizard.SelectBitmap.BTNPreview
  10646.       With .SampleBox
  10647.         .ZOrder := 11
  10648.         .Move(4665, 2715, 480, 480)
  10649.         .Visible := True
  10650.         With .PreviewTool
  10651.           .Position := 1
  10652.           With .bitmap
  10653.             .FileName := "envelop.ero"
  10654.             .ResId := 187180
  10655.           End With  'CtrlToolGadgetWizard.SelectBitmap.SampleBox.PreviewTool.bitmap
  10656.         End With  'CtrlToolGadgetWizard.SelectBitmap.SampleBox.PreviewTool
  10657.       End With  'CtrlToolGadgetWizard.SelectBitmap.SampleBox
  10658.       With .BtnFinish
  10659.         .ZOrder := 7
  10660.         .Move(6225, 4050, 825, 300)
  10661.       End With  'CtrlToolGadgetWizard.SelectBitmap.BtnFinish
  10662.       With .BtnNext
  10663.         .Enabled := False
  10664.         .ZOrder := 6
  10665.         .Move(5325, 4050, 825, 300)
  10666.       End With  'CtrlToolGadgetWizard.SelectBitmap.BtnNext
  10667.       With .BtnBack
  10668.         .ZOrder := 5
  10669.         .Move(4500, 4050, 825, 300)
  10670.       End With  'CtrlToolGadgetWizard.SelectBitmap.BtnBack
  10671.       With .BtnCancel
  10672.         .ZOrder := 4
  10673.         .Move(3600, 4050, 825, 300)
  10674.       End With  'CtrlToolGadgetWizard.SelectBitmap.BtnCancel
  10675.       With .ImgGraphic
  10676.         .ZOrder := 10
  10677.         .Move(225, 225, 2475, 3150)
  10678.         .Picture := CtrlToolGadgetWizard.Bitmap
  10679.       End With  'CtrlToolGadgetWizard.SelectBitmap.ImgGraphic
  10680.       With .LblInstruction
  10681.         .Caption := "What Bitmap should be used in the Palette?"
  10682.         .ZOrder := 9
  10683.         .Move(2850, 225, 4125, 375)
  10684.       End With  'CtrlToolGadgetWizard.SelectBitmap.LblInstruction
  10685.       With .Frame1
  10686.         .ZOrder := 8
  10687.         .Move(75, 3825, 6975, 75)
  10688.       End With  'CtrlToolGadgetWizard.SelectBitmap.Frame1
  10689.     End With  'CtrlToolGadgetWizard.SelectBitmap
  10690.     With .Bitmap
  10691.       .LoadType := "MemoryBased"
  10692.       .FileName := "envelop.ero"
  10693.       .ResId := 187808
  10694.     End With  'CtrlToolGadgetWizard.Bitmap
  10695.   End With  'CtrlToolGadgetWizard
  10696. ' Reconstruction commands for object: GroupEditor
  10697. '
  10698.   With GroupEditor
  10699.     With .EditorForm
  10700.       .Caption := "Group: GadgetConfigWizard"
  10701.       .Move(4590, 2520, 3660, 3795)
  10702.       .AccelForm := EnvelopForm
  10703.       .GroupRef := GadgetConfigWizard
  10704.       .ParentForReal := GroupEditor
  10705.       With .GroupList
  10706.         .BackColor := 12632256
  10707.         .ZOrder := 4
  10708.         .Move(0, 255, 3540, 3390)
  10709.         .Sorted := False
  10710.       End With  'GroupEditor.EditorForm.GroupList
  10711.       With .Up
  10712.         .Caption := "Up"
  10713.         .ZOrder := 1
  10714.         .Move(0, 0, 825, 270)
  10715.       End With  'GroupEditor.EditorForm.Up
  10716.       With .Down
  10717.         .Caption := "Down"
  10718.         .ZOrder := 2
  10719.         .Move(750, 0, 855, 270)
  10720.       End With  'GroupEditor.EditorForm.Down
  10721.       With .Delete
  10722.         .Caption := "Delete"
  10723.         .ZOrder := 3
  10724.         .Move(1590, 0, 855, 270)
  10725.       End With  'GroupEditor.EditorForm.Delete
  10726.     End With  'GroupEditor.EditorForm
  10727.   End With  'GroupEditor
  10728. ' Reconstruction commands for object: NewProjectForm
  10729. '
  10730.   With NewProjectForm
  10731.     .Caption := "New Project"
  10732.     .Font := DefaultDialogFont
  10733.     .Move(4005, 3960, 4995, 2340)
  10734.     .DefaultButton := NewProjectForm.BtnOK
  10735.     .CancelButton := NewProjectForm.BtnCancel
  10736.     .MaxButton := False
  10737.     .MinButton := False
  10738.     .GeneratedName := "Application1"
  10739.     With .LblProjType
  10740.       .Caption := "Project type:"
  10741.       .ZOrder := 13
  10742.       .Move(135, 135, 1200, 300)
  10743.       .WordWrap := False
  10744.     End With  'NewProjectForm.LblProjType
  10745.     With .LblProjName
  10746.       .Caption := "Project object name:"
  10747.       .ZOrder := 12
  10748.       .Move(135, 930, 1800, 300)
  10749.       .Alignment := "Right"
  10750.     End With  'NewProjectForm.LblProjName
  10751.     With .LblProjFile
  10752.       .Caption := "Project file:"
  10753.       .ZOrder := 11
  10754.       .Move(135, 1275, 1800, 210)
  10755.       .Alignment := "Right"
  10756.     End With  'NewProjectForm.LblProjFile
  10757.     With .OptApplication
  10758.       .Caption := "&Application"
  10759.       .ZOrder := 1
  10760.       .Move(1350, 90, 1275, 270)
  10761.       .TabStop := True
  10762.       .TabGroup := True
  10763.       .Value := True
  10764.     End With  'NewProjectForm.OptApplication
  10765.     With .OptLibrary
  10766.       .Caption := "Component &Library"
  10767.       .ZOrder := 2
  10768.       .Move(1350, 420, 1935, 270)
  10769.     End With  'NewProjectForm.OptLibrary
  10770.     With .LblEXEfile
  10771.       .Caption := "Application EXE file:"
  10772.       .ZOrder := 10
  10773.       .Move(135, 1620, 1800, 240)
  10774.       .Alignment := "Right"
  10775.     End With  'NewProjectForm.LblEXEfile
  10776.     With .TEProjName
  10777.       .ZOrder := 3
  10778.       .Move(1935, 900, 1845, 300)
  10779.     End With  'NewProjectForm.TEProjName
  10780.     With .TEProjFile
  10781.       .ZOrder := 4
  10782.       .Move(1935, 1230, 1845, 300)
  10783.     End With  'NewProjectForm.TEProjFile
  10784.     With .TEEXEfile
  10785.       .ZOrder := 5
  10786.       .Move(1935, 1575, 1845, 300)
  10787.     End With  'NewProjectForm.TEEXEfile
  10788.     With .BtnOK
  10789.       .Caption := "OK"
  10790.       .ZOrder := 6
  10791.       .Move(3915, 60, 900, 315)
  10792.     End With  'NewProjectForm.BtnOK
  10793.     With .BtnCancel
  10794.       .Caption := "Cancel"
  10795.       .ZOrder := 7
  10796.       .Move(3915, 435, 900, 315)
  10797.     End With  'NewProjectForm.BtnCancel
  10798.     With .BtnBrowseProjFile
  10799.       .Caption := "Browse..."
  10800.       .ZOrder := 8
  10801.       .Move(3840, 1230, 975, 300)
  10802.     End With  'NewProjectForm.BtnBrowseProjFile
  10803.     With .BtnBrowseEXEfile
  10804.       .Caption := "Browse..."
  10805.       .ZOrder := 9
  10806.       .Move(3840, 1575, 975, 300)
  10807.     End With  'NewProjectForm.BtnBrowseEXEfile
  10808.   End With  'NewProjectForm
  10809. ' Reconstruction commands for object: SelectModuleForm
  10810. '
  10811.   With SelectModuleForm
  10812.     .Caption := "Select module to add"
  10813.     .Font := DefaultDialogFont
  10814.     .Move(5070, 4365, 3615, 2475)
  10815.     .MaxButton := False
  10816.     .MinButton := False
  10817.     .module := Nothing
  10818.     With .LstModules
  10819.       .ZOrder := 1
  10820.       .Move(90, 360, 2220, 1590)
  10821.       .Sorted := False
  10822.     End With  'SelectModuleForm.LstModules
  10823.     With .BtnOK
  10824.       .Caption := "OK"
  10825.       .ZOrder := 2
  10826.       .Move(2400, 90, 1005, 315)
  10827.     End With  'SelectModuleForm.BtnOK
  10828.     With .BtnCancel
  10829.       .Caption := "Cancel"
  10830.       .ZOrder := 3
  10831.       .Move(2400, 495, 1005, 315)
  10832.     End With  'SelectModuleForm.BtnCancel
  10833.     With .BtnBrowse
  10834.       .Caption := "&Browse..."
  10835.       .ZOrder := 5
  10836.       .Move(2400, 1665, 1005, 315)
  10837.     End With  'SelectModuleForm.BtnBrowse
  10838.     With .LblModules
  10839.       .Caption := "Modules:"
  10840.       .ZOrder := 6
  10841.       .Move(90, 90, 900, 180)
  10842.     End With  'SelectModuleForm.LblModules
  10843.     With .BtnNew
  10844.       .Caption := "&New"
  10845.       .ZOrder := 4
  10846.       .Move(2400, 1260, 1005, 315)
  10847.     End With  'SelectModuleForm.BtnNew
  10848.   End With  'SelectModuleForm
  10849. End Code
  10850.